# HG changeset patch # User Tom Rodriguez # Date 1437416377 25200 # Node ID 11f9d9c2c1bff06d4dcbd0b662c4cf5595d546c6 # Parent f68516869b751097d0534df53115f4f553d1c07b PiNode with more precise piStamp should replace less precise piStamp diff -r f68516869b75 -r 11f9d9c2c1bf graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PiNode.java --- 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; }