# HG changeset patch # User Lukas Stadler # Date 1383732241 -3600 # Node ID 76a6070f7164752caa0e12b3bc3df437a5ae10f6 # Parent 43301f080126c5cc0667368f7cee370f75d5d4e3 LIRGenerator: don't create end-of-block JumpOps for blocks that end in a FallThroughOp with a target diff -r 43301f080126 -r 76a6070f7164 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java Tue Nov 05 20:03:42 2013 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java Wed Nov 06 11:04:01 2013 +0100 @@ -39,6 +39,7 @@ import com.oracle.graal.debug.*; import com.oracle.graal.graph.*; import com.oracle.graal.lir.*; +import com.oracle.graal.lir.StandardOp.FallThroughOp; import com.oracle.graal.lir.StandardOp.JumpOp; import com.oracle.graal.lir.StandardOp.LabelOp; import com.oracle.graal.nodes.*; @@ -426,7 +427,12 @@ return false; } LIRInstruction lirInstruction = instructions.get(instructions.size() - 1); - return lirInstruction instanceof StandardOp.JumpOp; + if (lirInstruction instanceof StandardOp.JumpOp) { + return true; + } else if (lirInstruction instanceof FallThroughOp) { + return ((FallThroughOp) lirInstruction).fallThroughTarget() != null; + } + return false; } private void doRoot(ValueNode instr) { diff -r 43301f080126 -r 76a6070f7164 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/EdgeMoveOptimizer.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/EdgeMoveOptimizer.java Tue Nov 05 20:03:42 2013 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/EdgeMoveOptimizer.java Wed Nov 06 11:04:01 2013 +0100 @@ -24,7 +24,7 @@ import java.util.*; -import com.oracle.graal.lir.StandardOp.*; +import com.oracle.graal.lir.StandardOp.MoveOp; import com.oracle.graal.nodes.cfg.*; /** @@ -182,9 +182,16 @@ assert numSux == 2 : "method should not be called otherwise"; - assert instructions.get(instructions.size() - 1) instanceof StandardOp.JumpOp : "block must end with unconditional jump"; + LIRInstruction lastInstruction = instructions.get(instructions.size() - 1); + if (lastInstruction instanceof StandardOp.FallThroughOp) { + assert ((StandardOp.FallThroughOp) lastInstruction).fallThroughTarget() != null : "block must end with unconditional jump"; + // fall through ops like switches cannot be optimized anyway - they have input operands + return; + } else { + assert lastInstruction instanceof StandardOp.JumpOp : "block must end with unconditional jump"; + } - if (instructions.get(instructions.size() - 1).hasState()) { + if (lastInstruction.hasState()) { // cannot optimize instructions when debug info is needed return; }