Search in sources :

Example 1 with IntegerLowerThanNode

use of org.graalvm.compiler.nodes.calc.IntegerLowerThanNode in project graal by oracle.

the class GuardPrioritiesTest method growingTest.

@Test
public void growingTest() {
    assumeTrue("GuardPriorities must be turned one", GraalOptions.GuardPriorities.getValue(getInitialOptions()));
    StructuredGraph graph = prepareGraph("growing");
    NodeIterable<GuardNode> guards = graph.getNodes(GuardNode.TYPE).filter(n -> n.inputs().filter(i -> i instanceof IntegerLowerThanNode).isNotEmpty());
    assertThat(guards, isNotEmpty());
    assumeThat(guards, hasCount(2));
    Iterator<GuardNode> iterator = guards.iterator();
    GuardNode g1 = iterator.next();
    GuardNode g2 = iterator.next();
    assertTrue("There should be one guard with speculation, the other one without", g1.getSpeculation().isNull() ^ g2.getSpeculation().isNull());
    GuardNode withSpeculation = g1.getSpeculation().isNull() ? g2 : g1;
    GuardNode withoutSpeculation = g1.getSpeculation().isNull() ? g1 : g2;
    assertOrderedAfterSchedule(graph, SchedulePhase.SchedulingStrategy.EARLIEST_WITH_GUARD_ORDER, withSpeculation, withoutSpeculation);
}
Also used : StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) IntegerLowerThanNode(org.graalvm.compiler.nodes.calc.IntegerLowerThanNode) GuardNode(org.graalvm.compiler.nodes.GuardNode) Test(org.junit.Test)

Aggregations

GuardNode (org.graalvm.compiler.nodes.GuardNode)1 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)1 IntegerLowerThanNode (org.graalvm.compiler.nodes.calc.IntegerLowerThanNode)1 Test (org.junit.Test)1