src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/GraphDecoder.java
changeset 57537 ecc6e394475f
parent 54601 c40b2a190173
child 58877 aec7bf35d6f5
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/GraphDecoder.java	Thu Jul 25 11:44:37 2019 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/GraphDecoder.java	Thu Jul 25 17:35:58 2019 -0400
@@ -319,7 +319,7 @@
         public static final NodeClass<ProxyPlaceholder> TYPE = NodeClass.create(ProxyPlaceholder.class);
 
         @Input ValueNode value;
-        @Input(InputType.Unchecked) Node proxyPoint;
+        @Input(InputType.Association) Node proxyPoint;
 
         public ProxyPlaceholder(ValueNode value, MergeNode proxyPoint) {
             super(TYPE, value.stamp(NodeView.DEFAULT));
@@ -884,14 +884,7 @@
 
                 if (!merge.isPhiAtMerge(existing)) {
                     /* Now we have two different values, so we need to create a phi node. */
-                    PhiNode phi;
-                    if (proxy instanceof ValueProxyNode) {
-                        phi = graph.addWithoutUnique(new ValuePhiNode(proxy.stamp(NodeView.DEFAULT), merge));
-                    } else if (proxy instanceof GuardProxyNode) {
-                        phi = graph.addWithoutUnique(new GuardPhiNode(merge));
-                    } else {
-                        throw GraalError.shouldNotReachHere();
-                    }
+                    PhiNode phi = proxy.createPhi(merge);
                     /* Add the inputs from all previous exits. */
                     for (int j = 0; j < merge.phiPredecessorCount() - 1; j++) {
                         phi.addInput(existing);
@@ -1336,6 +1329,11 @@
      * @param methodScope The current method.
      */
     protected void cleanupGraph(MethodScope methodScope) {
+        for (MergeNode merge : graph.getNodes(MergeNode.TYPE)) {
+            for (ProxyPlaceholder placeholder : merge.usages().filter(ProxyPlaceholder.class).snapshot()) {
+                placeholder.replaceAndDelete(placeholder.value);
+            }
+        }
         assert verifyEdges();
     }