changeset 10816:a61fa3e171e7

fixed bug in EdgeMoveOptimizer triggered by a backend (such as HSAIL) that has conditional branches with explicit input operands (as opposed to an implicit condition flags register)
author Doug Simon <doug.simon@oracle.com>
date Fri, 19 Jul 2013 12:45:59 +0200
parents 825d37fcdc9e
children 2c9332a969d6 0a5cfcf27c35
files graal/com.oracle.graal.lir/src/com/oracle/graal/lir/EdgeMoveOptimizer.java
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/EdgeMoveOptimizer.java	Thu Jul 18 13:31:08 2013 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/EdgeMoveOptimizer.java	Fri Jul 19 12:45:59 2013 +0200
@@ -190,10 +190,13 @@
         }
 
         LIRInstruction branch = instructions.get(instructions.size() - 2);
-        if (!(branch instanceof StandardOp.BranchOp) || branch.hasState()) {
-            // not a valid case for optimization
-            // currently, only blocks that end with two branches (conditional branch followed
-            // by unconditional branch) are optimized
+        if (!(branch instanceof StandardOp.BranchOp) || branch.hasOperands()) {
+            // Only blocks that end with two branches (conditional branch followed
+            // by unconditional branch) are optimized.
+            // In addition, a conditional branch with operands (including state) cannot
+            // be optimized. Moving a successor instruction before such a branch may
+            // interfere with the operands of the branch. For example, a successive move
+            // instruction may redefine an input operand of the branch.
             return;
         }