Search in sources :

Example 1 with IncrementalCanonicalizerPhase

use of org.graalvm.compiler.phases.common.IncrementalCanonicalizerPhase in project graal by oracle.

the class MemoryGraphCanonicalizeTest method testGraph.

public void testGraph(String name, int expectedWrites) {
    StructuredGraph graph = parseEager(name, StructuredGraph.AllowAssumptions.YES);
    HighTierContext context = getDefaultHighTierContext();
    CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
    new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
    new IncrementalCanonicalizerPhase<>(canonicalizer, new FloatingReadPhase()).apply(graph, context);
    new CanonicalizerPhase().apply(graph, context);
    int writes = graph.getNodes().filter(WriteNode.class).count();
    assertTrue(writes == expectedWrites, "Expected %d writes, found %d", expectedWrites, writes);
}
Also used : StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) LoweringPhase(org.graalvm.compiler.phases.common.LoweringPhase) IncrementalCanonicalizerPhase(org.graalvm.compiler.phases.common.IncrementalCanonicalizerPhase) CanonicalizerPhase(org.graalvm.compiler.phases.common.CanonicalizerPhase) HighTierContext(org.graalvm.compiler.phases.tiers.HighTierContext) WriteNode(org.graalvm.compiler.nodes.memory.WriteNode) FloatingReadPhase(org.graalvm.compiler.phases.common.FloatingReadPhase)

Aggregations

StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)1 WriteNode (org.graalvm.compiler.nodes.memory.WriteNode)1 CanonicalizerPhase (org.graalvm.compiler.phases.common.CanonicalizerPhase)1 FloatingReadPhase (org.graalvm.compiler.phases.common.FloatingReadPhase)1 IncrementalCanonicalizerPhase (org.graalvm.compiler.phases.common.IncrementalCanonicalizerPhase)1 LoweringPhase (org.graalvm.compiler.phases.common.LoweringPhase)1 HighTierContext (org.graalvm.compiler.phases.tiers.HighTierContext)1