Skip to content

Commit

Permalink
[GR-33468] Canonicalize snippets after fixing returns.
Browse files Browse the repository at this point in the history
PullRequest: graal/9652
  • Loading branch information
tkrodriguez committed Sep 1, 2021
2 parents 15d3747 + 3438aeb commit bdc8ab8
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@
import org.graalvm.compiler.graph.NodeMap;
import org.graalvm.compiler.graph.NodeSourcePosition;
import org.graalvm.compiler.graph.Position;
import org.graalvm.compiler.nodes.spi.Simplifiable;
import org.graalvm.compiler.nodes.spi.SimplifierTool;
import org.graalvm.compiler.loop.phases.LoopTransformations;
import org.graalvm.compiler.nodeinfo.InputType;
import org.graalvm.compiler.nodeinfo.NodeCycles;
Expand Down Expand Up @@ -144,6 +142,8 @@
import org.graalvm.compiler.nodes.spi.CoreProviders;
import org.graalvm.compiler.nodes.spi.LoweringTool;
import org.graalvm.compiler.nodes.spi.MemoryEdgeProxy;
import org.graalvm.compiler.nodes.spi.Simplifiable;
import org.graalvm.compiler.nodes.spi.SimplifierTool;
import org.graalvm.compiler.nodes.spi.SnippetParameterInfo;
import org.graalvm.compiler.nodes.type.StampTool;
import org.graalvm.compiler.nodes.util.GraphUtil;
Expand Down Expand Up @@ -1086,6 +1086,7 @@ protected SnippetTemplate(OptionValues options, DebugContext debug, final Provid
merge.setNext(this.returnNode);
}
debug.dump(DebugContext.INFO_LEVEL, snippet, "After fixing returns");
canonicalizer.apply(snippet, providers);

boolean needsMergeStateMap = !guardsStage.areFrameStatesAtDeopts() && (containsMerge || containsLoopExit);

Expand All @@ -1099,6 +1100,8 @@ protected SnippetTemplate(OptionValues options, DebugContext debug, final Provid

assert verifyIntrinsicsProcessed(snippetCopy);

curDeoptNodes.removeIf(x -> x.asNode().isDeleted());
curSideEffectNodes.removeIf(x -> x.asNode().isDeleted());
this.sideEffectNodes = curSideEffectNodes;
this.deoptNodes = curDeoptNodes;
this.placeholderStampedNodes = curPlaceholderStampedNodes;
Expand All @@ -1114,6 +1117,7 @@ protected SnippetTemplate(OptionValues options, DebugContext debug, final Provid
DebugContext.counter("SnippetTemplateNodeCount[%#s]", args).add(debug, nodes.size());
}
debug.dump(DebugContext.INFO_LEVEL, snippet, "SnippetTemplate final state");
assert snippet.verify();
this.snippet.freeze();

} catch (Throwable ex) {
Expand Down

0 comments on commit bdc8ab8

Please sign in to comment.