changeset 22261:11f9d9c2c1bf

PiNode with more precise piStamp should replace less precise piStamp
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Mon, 20 Jul 2015 11:19:37 -0700
parents f68516869b75
children 71a696ca2862
files graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PiNode.java
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PiNode.java	Mon Jul 20 11:19:21 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PiNode.java	Mon Jul 20 11:19:37 2015 -0700
@@ -106,6 +106,23 @@
         if (stamp().equals(object().stamp())) {
             return object();
         }
+        if (getGuard() != null) {
+            for (Node use : getGuard().asNode().usages()) {
+                if (use instanceof PiNode) {
+                    PiNode otherPi = (PiNode) use;
+                    if (object() == otherPi.object() && stamp().equals(otherPi.stamp())) {
+                        /*
+                         * Two PiNodes with the same guard and same result, so return the one with
+                         * the more precise piStamp.
+                         */
+                        Stamp newStamp = piStamp.join(otherPi.piStamp);
+                        if (newStamp.equals(otherPi.piStamp)) {
+                            return otherPi;
+                        }
+                    }
+                }
+            }
+        }
         return this;
     }