changeset 13724:256bc461645e

split a negated guard with a ShortCircuitOr condition into two guards
author Lukas Stadler <lukas.stadler@jku.at>
date Wed, 22 Jan 2014 10:51:32 +0100
parents 1834ae0bc965
children 8d8732e14447
files graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java	Tue Jan 21 18:35:46 2014 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java	Wed Jan 22 10:51:32 2014 +0100
@@ -104,12 +104,16 @@
         if (condition() instanceof LogicNegationNode) {
             LogicNegationNode negation = (LogicNegationNode) condition();
             return graph().unique(new GuardNode(negation.getInput(), getGuard(), reason, action, !negated, speculation));
-        }
-        if (condition() instanceof LogicConstantNode) {
+        } else if (condition() instanceof LogicConstantNode) {
             LogicConstantNode c = (LogicConstantNode) condition();
             if (c.getValue() != negated) {
                 return graph().start();
             }
+        } else if (negated && condition() instanceof ShortCircuitOrNode) {
+            ShortCircuitOrNode or = (ShortCircuitOrNode) condition();
+            GuardNode firstGuard = graph().unique(new GuardNode(or.getX(), getGuard(), reason, action, !or.isXNegated(), speculation));
+            GuardNode secondGuard = graph().unique(new GuardNode(or.getY(), firstGuard, reason, action, or.isYNegated(), speculation));
+            return secondGuard;
         }
         return this;
     }