Search in sources :

Example 1 with NodePredicate

use of org.graalvm.compiler.graph.iterators.NodePredicate in project graal by oracle.

the class LoopPhiCanonicalizerTest method test.

@Test
public void test() {
    StructuredGraph graph = parseEager("loopSnippet", AllowAssumptions.YES);
    NodePredicate loopPhis = node -> node instanceof PhiNode && ((PhiNode) node).merge() instanceof LoopBeginNode;
    PhaseContext context = new PhaseContext(getProviders());
    Assert.assertEquals(5, graph.getNodes().filter(loopPhis).count());
    new CanonicalizerPhase().apply(graph, context);
    Assert.assertEquals(2, graph.getNodes().filter(loopPhis).count());
    test("loopSnippet");
}
Also used : LoopBeginNode(org.graalvm.compiler.nodes.LoopBeginNode) NodePredicate(org.graalvm.compiler.graph.iterators.NodePredicate) StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) BeforeClass(org.junit.BeforeClass) CanonicalizerPhase(org.graalvm.compiler.phases.common.CanonicalizerPhase) Test(org.junit.Test) PhaseContext(org.graalvm.compiler.phases.tiers.PhaseContext) GraalCompilerTest(org.graalvm.compiler.core.test.GraalCompilerTest) Assert(org.junit.Assert) AllowAssumptions(org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions) PhiNode(org.graalvm.compiler.nodes.PhiNode) PhaseContext(org.graalvm.compiler.phases.tiers.PhaseContext) LoopBeginNode(org.graalvm.compiler.nodes.LoopBeginNode) StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) PhiNode(org.graalvm.compiler.nodes.PhiNode) CanonicalizerPhase(org.graalvm.compiler.phases.common.CanonicalizerPhase) NodePredicate(org.graalvm.compiler.graph.iterators.NodePredicate) Test(org.junit.Test) GraalCompilerTest(org.graalvm.compiler.core.test.GraalCompilerTest)

Aggregations

GraalCompilerTest (org.graalvm.compiler.core.test.GraalCompilerTest)1 NodePredicate (org.graalvm.compiler.graph.iterators.NodePredicate)1 LoopBeginNode (org.graalvm.compiler.nodes.LoopBeginNode)1 PhiNode (org.graalvm.compiler.nodes.PhiNode)1 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)1 AllowAssumptions (org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions)1 CanonicalizerPhase (org.graalvm.compiler.phases.common.CanonicalizerPhase)1 PhaseContext (org.graalvm.compiler.phases.tiers.PhaseContext)1 Assert (org.junit.Assert)1 BeforeClass (org.junit.BeforeClass)1 Test (org.junit.Test)1