diff graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java @ 2789:aeccd2af4e9e

Fixes around critical edge split and placeholder removal after goto removal.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Wed, 25 May 2011 16:48:28 +0200
parents df4c5254c5cc
children d3fc4fe063bf
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java	Wed May 25 14:33:44 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java	Wed May 25 16:48:28 2011 +0200
@@ -253,7 +253,7 @@
                 }
             }
         }
-        if (block.blockSuccessors().size() == 1 && !(block.getInstructions().get(block.getInstructions().size() - 1) instanceof BlockEnd)) {
+        if (block.blockSuccessors().size() == 1 && (block.getInstructions().size() == 0  || !(block.getInstructions().get(block.getInstructions().size() - 1) instanceof BlockEnd))) {
             moveToPhi();
             block.lir().jump(block.blockSuccessors().get(0));
         }
@@ -591,7 +591,11 @@
     }
 
     protected LIRBlock getLIRBlock(Instruction b) {
-        return ir.valueToBlock.get(b);
+        LIRBlock result = ir.valueToBlock.get(b);
+        if (result == null) {
+            TTY.println("instruction without lir block: " + b);
+        }
+        return result;
     }
 
     @Override
@@ -1324,7 +1328,7 @@
 
                     PhiResolver resolver = new PhiResolver(this);
                     for (Phi phi : phis) {
-                        if (!phi.isDeadPhi() && phi.valueCount() > predIndex) {
+                        if (!phi.isDeadPhi()) {
                             Value curVal = phi.valueAt(predIndex);
                             if (curVal != null && curVal != phi) {
                                 if (curVal instanceof Phi) {