# HG changeset patch # User Stefan Anzinger # Date 1422979335 -3600 # Node ID d2ec5e56ed312451c16218fb84c891cf79807965 # Parent d45677473bead06c19e75296867cd0396f179419 Only lowerToIf, when stage does not allow FloatingGuards diff -r d45677473bea -r d2ec5e56ed31 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java --- 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); }