changeset 11782:106bd0ff2498

add support for a node to canonicalize itself to a ControlSinkNode
author Doug Simon <doug.simon@oracle.com>
date Wed, 25 Sep 2013 12:16:26 +0200
parents 492766ec345a
children 9c98944c040b
files graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java
diffstat 1 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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());