< prev index next >
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/GraphEffectList.java
Print this page
@@ -221,11 +221,11 @@
* @param insertBefore
*
*/
public void replaceAtUsages(ValueNode node, ValueNode replacement, FixedNode insertBefore) {
assert node != null && replacement != null : node + " " + replacement;
- assert node.stamp(NodeView.DEFAULT).isCompatible(replacement.stamp(NodeView.DEFAULT)) : "Replacement node stamp not compatible " + node.stamp(NodeView.DEFAULT) + " vs " +
+ assert !node.hasUsages() || node.stamp(NodeView.DEFAULT).isCompatible(replacement.stamp(NodeView.DEFAULT)) : "Replacement node stamp not compatible " + node.stamp(NodeView.DEFAULT) + " vs " +
replacement.stamp(NodeView.DEFAULT);
add("replace at usages", (graph, obsoleteNodes) -> {
assert node.isAlive();
ValueNode replacementNode = graph.addOrUniqueWithInputs(replacement);
assert replacementNode.isAlive();
@@ -238,11 +238,11 @@
* replacement has a less precise stamp than the original node. This can happen for
* example in the context of read nodes and unguarded pi nodes where the pi will be used
* to improve the stamp information of the read. Such a read might later be replaced
* with a read with a less precise stamp.
*/
- if (!node.stamp(NodeView.DEFAULT).equals(replacementNode.stamp(NodeView.DEFAULT))) {
+ if (node.hasUsages() && !node.stamp(NodeView.DEFAULT).equals(replacementNode.stamp(NodeView.DEFAULT))) {
replacementNode = graph.unique(new PiNode(replacementNode, node.stamp(NodeView.DEFAULT)));
}
node.replaceAtUsages(replacementNode);
if (node instanceof FixedWithNextNode) {
GraphUtil.unlinkFixedNode((FixedWithNextNode) node);
< prev index next >