use of org.graalvm.compiler.phases.common.CanonicalizerPhase in project graal by oracle.
the class BoxingEliminationTest method processMethod.
private void processMethod(final String snippet) {
graph = parseEager(snippet, AllowAssumptions.NO);
HighTierContext context = getDefaultHighTierContext();
new InliningPhase(new CanonicalizerPhase()).apply(graph, context);
new PartialEscapePhase(false, new CanonicalizerPhase(), graph.getOptions()).apply(graph, context);
}
use of org.graalvm.compiler.phases.common.CanonicalizerPhase in project graal by oracle.
the class CompareCanonicalizerTest method testCanonicalComparison.
@Test
public void testCanonicalComparison() {
StructuredGraph referenceGraph = parseEager("referenceCanonicalComparison", AllowAssumptions.NO);
for (int i = 1; i < 4; i++) {
StructuredGraph graph = parseEager("canonicalCompare" + i, AllowAssumptions.NO);
assertEquals(referenceGraph, graph);
}
new CanonicalizerPhase().apply(referenceGraph, new PhaseContext(getProviders()));
for (int i = 1; i < 4; i++) {
StructuredGraph graph = getCanonicalizedGraph("canonicalCompare" + i);
assertEquals(referenceGraph, graph);
}
}
use of org.graalvm.compiler.phases.common.CanonicalizerPhase in project graal by oracle.
the class CompareCanonicalizerTest2 method getCanonicalizedGraph.
private StructuredGraph getCanonicalizedGraph(String name) {
StructuredGraph graph = parseEager(name, AllowAssumptions.YES);
new CanonicalizerPhase().apply(graph, new PhaseContext(getProviders()));
return graph;
}
use of org.graalvm.compiler.phases.common.CanonicalizerPhase in project graal by oracle.
the class CompareCanonicalizerTest3 method assertCanonicallyEqual.
protected void assertCanonicallyEqual(String snippet, String reference) {
StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES);
PhaseContext context = new PhaseContext(getProviders());
CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
canonicalizer.apply(graph, context);
canonicalizer.apply(graph, context);
StructuredGraph referenceGraph = parseEager(reference, AllowAssumptions.YES);
canonicalizer.apply(referenceGraph, context);
canonicalizer.apply(referenceGraph, context);
assertEquals(referenceGraph, graph, true, true);
}
use of org.graalvm.compiler.phases.common.CanonicalizerPhase in project graal by oracle.
the class FloatingReadTest method test.
@SuppressWarnings("try")
private void test(final String snippet) {
DebugContext debug = getDebugContext();
try (DebugContext.Scope s = debug.scope("FloatingReadTest", new DebugDumpScope(snippet))) {
StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES);
PhaseContext context = new PhaseContext(getProviders());
new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
new FloatingReadPhase().apply(graph);
ReturnNode returnNode = null;
MonitorExit monitorexit = null;
for (Node n : graph.getNodes()) {
if (n instanceof ReturnNode) {
assert returnNode == null;
returnNode = (ReturnNode) n;
} else if (n instanceof MonitorExit) {
monitorexit = (MonitorExit) n;
}
}
debug.dump(DebugContext.BASIC_LEVEL, graph, "After lowering");
Assert.assertNotNull(returnNode);
Assert.assertNotNull(monitorexit);
Assert.assertTrue(returnNode.result() instanceof FloatingReadNode);
FloatingReadNode read = (FloatingReadNode) returnNode.result();
assertOrderedAfterSchedule(graph, read, (Node) monitorexit);
} catch (Throwable e) {
throw debug.handle(e);
}
}
Aggregations