changeset 9373:f11381a65725

Do not swap if nodes when there is a loop exit node between them. Do not swap if one of the compares has unorderedIsTrue set.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sat, 27 Apr 2013 20:17:10 +0200
parents 98603705e565
children 8649dbda7d25
files graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java	Sat Apr 27 18:06:32 2013 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java	Sat Apr 27 20:17:10 2013 +0200
@@ -166,7 +166,7 @@
             return;
         }
 
-        if (falseSuccessor().usages().isEmpty() && falseSuccessor().next() instanceof IfNode) {
+        if (falseSuccessor().usages().isEmpty() && (!(falseSuccessor() instanceof LoopExitNode)) && falseSuccessor().next() instanceof IfNode) {
             BeginNode intermediateBegin = falseSuccessor();
             IfNode nextIf = (IfNode) intermediateBegin.next();
             double probabilityB = (1.0 - this.trueSuccessorProbability) * nextIf.trueSuccessorProbability;
@@ -251,12 +251,18 @@
         } else if (a instanceof CompareNode) {
             CompareNode compareA = (CompareNode) a;
             Condition conditionA = compareA.condition();
+            if (compareA.unorderedIsTrue()) {
+                return false;
+            }
             if (b instanceof CompareNode) {
                 CompareNode compareB = (CompareNode) b;
                 if (compareA == compareB) {
                     Debug.log("Same conditions => do not swap and leave the work for global value numbering.");
                     return false;
                 }
+                if (compareB.unorderedIsTrue()) {
+                    return false;
+                }
                 Condition comparableCondition = null;
                 Condition conditionB = compareB.condition();
                 if (compareB.x() == compareA.x() && compareB.y() == compareA.y()) {