# HG changeset patch # User Doug Simon # Date 1380104186 -7200 # Node ID 106bd0ff2498b2e29625d53012c56b5cd628202c # Parent 492766ec345a4dabfb3f171f804f310c2ea29a7e add support for a node to canonicalize itself to a ControlSinkNode diff -r 492766ec345a -r 106bd0ff2498 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java Wed Sep 25 10:20:11 2013 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java Wed Sep 25 12:16:26 2013 +0200 @@ -267,7 +267,7 @@ // @formatter:off // cases: original node: // |Floating|Fixed-unconnected|Fixed-connected| -// -------------------------------------------- +// -------------------------------------------| // null| 1 | X | 3 | // -------------------------------------------- // Floating| 2 | X | 4 | @@ -276,6 +276,8 @@ // -------------------------------------------- // Fixed-connected| 2 | X | 6 | // -------------------------------------------- +// ControlSink| X | X | 7 | +// -------------------------------------------- // X: must not happen (checked with assertions) // @formatter:on private boolean performReplacement(final Node node, ValueNode canonical) { @@ -300,9 +302,16 @@ assert node instanceof FixedWithNextNode && node.predecessor() != null : node + " -> " + canonical + " : node should be fixed & connected (" + node.predecessor() + ")"; FixedWithNextNode fixedWithNext = (FixedWithNextNode) node; - // When removing a fixed node, new canonicalization opportunities for its -// successor - // may arise + if (canonical instanceof ControlSinkNode) { + // case 7 + FixedWithNextNode pred = (FixedWithNextNode) node.predecessor(); + GraphUtil.killCFG(fixedWithNext); + pred.setNext((FixedNode) canonical); + return true; + } + + // When removing a fixed node, new canonicalization + // opportunities for its successor may arise assert fixedWithNext.next() != null; tool.addToWorkList(fixedWithNext.next());