Mercurial > hg > truffle
diff graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertDeoptimizeToGuardPhase.java @ 15471:ef315dfdda35
new GraphUtil.predecessorIterable
author | Lukas Stadler <lukas.stadler@oracle.com> |
---|---|
date | Fri, 02 May 2014 14:47:09 +0200 |
parents | df2ef5204f2b |
children | df6f2365b153 |
line wrap: on
line diff
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertDeoptimizeToGuardPhase.java Fri May 02 12:02:27 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertDeoptimizeToGuardPhase.java Fri May 02 14:47:09 2014 +0200 @@ -35,27 +35,20 @@ /** * This phase will find branches which always end with a {@link DeoptimizeNode} and replace their * {@link ControlSplitNode ControlSplitNodes} with {@link FixedGuardNode FixedGuardNodes}. - * + * * This is useful because {@link FixedGuardNode FixedGuardNodes} will be lowered to * {@link GuardNode GuardNodes} which can later be optimized more aggressively than control-flow * constructs. - * + * * This is currently only done for branches that start from a {@link IfNode}. If it encounters a * branch starting at an other kind of {@link ControlSplitNode}, it will only bring the * {@link DeoptimizeNode} as close to the {@link ControlSplitNode} as possible. - * + * */ public class ConvertDeoptimizeToGuardPhase extends Phase { private static BeginNode findBeginNode(FixedNode startNode) { - Node n = startNode; - while (true) { - if (n instanceof BeginNode) { - return (BeginNode) n; - } else { - n = n.predecessor(); - } - } + return GraphUtil.predecessorIterable(startNode).filter(BeginNode.class).first(); } @Override