changeset 19100:d2ec5e56ed31

Only lowerToIf, when stage does not allow FloatingGuards
author Stefan Anzinger <stefan.anzinger@oracle.com>
date Tue, 03 Feb 2015 17:02:15 +0100
parents d45677473bea
children 212299803bf6
files graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java
diffstat 1 files changed, 15 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java	Tue Feb 03 16:59:56 2015 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java	Tue Feb 03 17:02:15 2015 +0100
@@ -69,18 +69,21 @@
 
     @Override
     public void lower(LoweringTool tool) {
-        /*
-         * Don't allow guards with action None and reason RuntimeConstraint to float. In cases where
-         * 2 guards are testing equivalent conditions they might be lowered at the same location. If
-         * the guard with the None action is lowered before the the other guard then the code will
-         * be stuck repeatedly deoptimizing without invalidating the code. Conditional elimination
-         * will eliminate the guard if it's truly redundant in this case.
-         */
-        if (graph().getGuardsStage().allowsFloatingGuards() && (getAction() != DeoptimizationAction.None || getReason() != DeoptimizationReason.RuntimeConstraint)) {
-            ValueNode guard = tool.createGuard(this, condition(), getReason(), getAction(), isNegated()).asNode();
-            this.replaceAtUsages(guard);
-            ValueAnchorNode newAnchor = graph().add(new ValueAnchorNode(guard.asNode()));
-            graph().replaceFixedWithFixed(this, newAnchor);
+        if (graph().getGuardsStage().allowsFloatingGuards()) {
+            /*
+             * Don't allow guards with action None and reason RuntimeConstraint to float. In cases
+             * where 2 guards are testing equivalent conditions they might be lowered at the same
+             * location. If the guard with the None action is lowered before the the other guard
+             * then the code will be stuck repeatedly deoptimizing without invalidating the code.
+             * Conditional elimination will eliminate the guard if it's truly redundant in this
+             * case.
+             */
+            if (getAction() != DeoptimizationAction.None || getReason() != DeoptimizationReason.RuntimeConstraint) {
+                ValueNode guard = tool.createGuard(this, condition(), getReason(), getAction(), isNegated()).asNode();
+                this.replaceAtUsages(guard);
+                ValueAnchorNode newAnchor = graph().add(new ValueAnchorNode(guard.asNode()));
+                graph().replaceFixedWithFixed(this, newAnchor);
+            }
         } else {
             lowerToIf().lower(tool);
         }