Search in sources :

Example 1 with LoopUnswitchingPhase

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

the class LoopUnswitchTest method test.

@SuppressWarnings("try")
private void test(String snippet, String referenceSnippet) {
    DebugContext debug = getDebugContext();
    final StructuredGraph graph = parseEager(snippet, AllowAssumptions.NO);
    final StructuredGraph referenceGraph = parseEager(referenceSnippet, AllowAssumptions.NO);
    new LoopUnswitchingPhase(new DefaultLoopPolicies()).apply(graph);
    // Framestates create comparison problems
    graph.clearAllStateAfter();
    referenceGraph.clearAllStateAfter();
    new CanonicalizerPhase().apply(graph, new PhaseContext(getProviders()));
    new CanonicalizerPhase().apply(referenceGraph, new PhaseContext(getProviders()));
    try (DebugContext.Scope s = debug.scope("Test", new DebugDumpScope("Test:" + snippet))) {
        assertEquals(referenceGraph, graph);
    } catch (Throwable e) {
        throw debug.handle(e);
    }
}
Also used : PhaseContext(org.graalvm.compiler.phases.tiers.PhaseContext) StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) DebugDumpScope(org.graalvm.compiler.debug.DebugDumpScope) DefaultLoopPolicies(org.graalvm.compiler.loop.DefaultLoopPolicies) LoopUnswitchingPhase(org.graalvm.compiler.loop.phases.LoopUnswitchingPhase) CanonicalizerPhase(org.graalvm.compiler.phases.common.CanonicalizerPhase) DebugContext(org.graalvm.compiler.debug.DebugContext)

Aggregations

DebugContext (org.graalvm.compiler.debug.DebugContext)1 DebugDumpScope (org.graalvm.compiler.debug.DebugDumpScope)1 DefaultLoopPolicies (org.graalvm.compiler.loop.DefaultLoopPolicies)1 LoopUnswitchingPhase (org.graalvm.compiler.loop.phases.LoopUnswitchingPhase)1 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)1 CanonicalizerPhase (org.graalvm.compiler.phases.common.CanonicalizerPhase)1 PhaseContext (org.graalvm.compiler.phases.tiers.PhaseContext)1