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