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);
}
}
Aggregations