Search in sources :

Example 1 with LoopPeelingPhase

use of org.graalvm.compiler.loop.phases.LoopPeelingPhase in project graal by oracle.

the class BoxingEliminationTest method compareGraphs.

private void compareGraphs(final String snippet, final String referenceSnippet, final boolean loopPeeling, final boolean excludeVirtual) {
    graph = parseEager(snippet, AllowAssumptions.NO);
    HighTierContext context = getDefaultHighTierContext();
    CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
    canonicalizer.apply(graph, context);
    new InliningPhase(new CanonicalizerPhase()).apply(graph, context);
    if (loopPeeling) {
        new LoopPeelingPhase(new DefaultLoopPolicies()).apply(graph, context);
    }
    new DeadCodeEliminationPhase().apply(graph);
    canonicalizer.apply(graph, context);
    new PartialEscapePhase(false, canonicalizer, graph.getOptions()).apply(graph, context);
    new DeadCodeEliminationPhase().apply(graph);
    canonicalizer.apply(graph, context);
    StructuredGraph referenceGraph = parseEager(referenceSnippet, AllowAssumptions.YES);
    new InliningPhase(new CanonicalizerPhase()).apply(referenceGraph, context);
    new DeadCodeEliminationPhase().apply(referenceGraph);
    new CanonicalizerPhase().apply(referenceGraph, context);
    assertEquals(referenceGraph, graph, excludeVirtual, true);
}
Also used : LoopPeelingPhase(org.graalvm.compiler.loop.phases.LoopPeelingPhase) PartialEscapePhase(org.graalvm.compiler.virtual.phases.ea.PartialEscapePhase) StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) DefaultLoopPolicies(org.graalvm.compiler.loop.DefaultLoopPolicies) CanonicalizerPhase(org.graalvm.compiler.phases.common.CanonicalizerPhase) HighTierContext(org.graalvm.compiler.phases.tiers.HighTierContext) InliningPhase(org.graalvm.compiler.phases.common.inlining.InliningPhase) DeadCodeEliminationPhase(org.graalvm.compiler.phases.common.DeadCodeEliminationPhase)

Example 2 with LoopPeelingPhase

use of org.graalvm.compiler.loop.phases.LoopPeelingPhase in project graal by oracle.

the class EscapeAnalysisTest method testPeeledLoop.

@Test
public void testPeeledLoop() {
    prepareGraph("testPeeledLoopSnippet", false);
    new LoopPeelingPhase(new DefaultLoopPolicies()).apply(graph, getDefaultHighTierContext());
    new SchedulePhase(graph.getOptions()).apply(graph);
}
Also used : LoopPeelingPhase(org.graalvm.compiler.loop.phases.LoopPeelingPhase) SchedulePhase(org.graalvm.compiler.phases.schedule.SchedulePhase) DefaultLoopPolicies(org.graalvm.compiler.loop.DefaultLoopPolicies) Test(org.junit.Test)

Aggregations

DefaultLoopPolicies (org.graalvm.compiler.loop.DefaultLoopPolicies)2 LoopPeelingPhase (org.graalvm.compiler.loop.phases.LoopPeelingPhase)2 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)1 CanonicalizerPhase (org.graalvm.compiler.phases.common.CanonicalizerPhase)1 DeadCodeEliminationPhase (org.graalvm.compiler.phases.common.DeadCodeEliminationPhase)1 InliningPhase (org.graalvm.compiler.phases.common.inlining.InliningPhase)1 SchedulePhase (org.graalvm.compiler.phases.schedule.SchedulePhase)1 HighTierContext (org.graalvm.compiler.phases.tiers.HighTierContext)1 PartialEscapePhase (org.graalvm.compiler.virtual.phases.ea.PartialEscapePhase)1 Test (org.junit.Test)1