changeset 8272:0db1cb049a78

Remove usage of negate() in word type rewriter phase.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Wed, 13 Mar 2013 17:14:58 +0100
parents f5e26f69f164
children 53683dc2815e
files graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java	Wed Mar 13 17:13:11 2013 +0100
+++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java	Wed Mar 13 17:14:58 2013 +0100
@@ -247,15 +247,17 @@
         } else {
             comparison = new IntegerLessThanNode(a, b);
         }
-        ConditionalNode materialize = graph.unique(new ConditionalNode(graph.unique(comparison), ConstantNode.forInt(1, graph), ConstantNode.forInt(0, graph)));
 
-        ValueNode op;
+        ConstantNode trueValue = ConstantNode.forInt(1, graph);
+        ConstantNode falseValue = ConstantNode.forInt(0, graph);
+
         if (condition.canonicalNegate()) {
-            op = (ValueNode) materialize.negate();
-        } else {
-            op = materialize;
+            ConstantNode temp = trueValue;
+            trueValue = falseValue;
+            falseValue = temp;
         }
-        return op;
+        ConditionalNode materialize = graph.unique(new ConditionalNode(graph.unique(comparison), trueValue, falseValue));
+        return materialize;
     }
 
     private static ValueNode readOp(StructuredGraph graph, ValueNode base, ValueNode offset, Invoke invoke, Kind readKind, Object locationIdentity) {