Skip to content

Commit

Permalink
Make sure stamp does not get less precise when applying Graph effects…
Browse files Browse the repository at this point in the history
… from read elimination and PEA.
  • Loading branch information
thomaswue committed Feb 13, 2017
1 parent bdd86ff commit 5598d39
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@
import org.graalvm.compiler.nodes.FrameState;
import org.graalvm.compiler.nodes.IfNode;
import org.graalvm.compiler.nodes.PhiNode;
import org.graalvm.compiler.nodes.PiNode;
import org.graalvm.compiler.nodes.StructuredGraph;
import org.graalvm.compiler.nodes.ValueNode;
import org.graalvm.compiler.nodes.ValuePhiNode;
import org.graalvm.compiler.nodes.debug.DynamicCounterNode;
import org.graalvm.compiler.nodes.debug.WeakCounterNode;
import org.graalvm.compiler.nodes.util.GraphUtil;
Expand Down Expand Up @@ -220,6 +222,12 @@ public void replaceAtUsages(ValueNode node, ValueNode replacement, FixedNode ins
if (replacementNode instanceof FixedWithNextNode && ((FixedWithNextNode) replacementNode).next() == null) {
graph.addBeforeFixed(insertBefore, (FixedWithNextNode) replacementNode);
}
if (replacementNode instanceof ValuePhiNode) {
ValuePhiNode valuePhiNode = (ValuePhiNode) replacementNode;
if (!node.stamp().equals(valuePhiNode.stamp())) {
replacementNode = graph.unique(new PiNode(replacementNode, node.stamp()));
}
}
node.replaceAtUsages(replacementNode);
if (node instanceof FixedWithNextNode) {
GraphUtil.unlinkFixedNode((FixedWithNextNode) node);
Expand Down

0 comments on commit 5598d39

Please sign in to comment.