src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ConditionalEliminationTest10.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
26 |
26 |
27 import org.graalvm.compiler.api.directives.GraalDirectives; |
27 import org.graalvm.compiler.api.directives.GraalDirectives; |
28 import org.graalvm.compiler.nodes.GuardNode; |
28 import org.graalvm.compiler.nodes.GuardNode; |
29 import org.graalvm.compiler.nodes.StructuredGraph; |
29 import org.graalvm.compiler.nodes.StructuredGraph; |
30 import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions; |
30 import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions; |
|
31 import org.graalvm.compiler.nodes.spi.CoreProviders; |
31 import org.graalvm.compiler.nodes.spi.LoweringTool; |
32 import org.graalvm.compiler.nodes.spi.LoweringTool; |
32 import org.graalvm.compiler.phases.common.CanonicalizerPhase; |
33 import org.graalvm.compiler.phases.common.CanonicalizerPhase; |
|
34 import org.graalvm.compiler.phases.common.ConditionalEliminationPhase; |
33 import org.graalvm.compiler.phases.common.LoweringPhase; |
35 import org.graalvm.compiler.phases.common.LoweringPhase; |
34 import org.graalvm.compiler.phases.common.ConditionalEliminationPhase; |
|
35 import org.graalvm.compiler.phases.tiers.PhaseContext; |
|
36 import org.junit.Assert; |
36 import org.junit.Assert; |
37 import org.junit.Test; |
37 import org.junit.Test; |
38 |
38 |
39 /** |
39 /** |
40 * This test checks the combined action of |
40 * This test checks the combined action of |
92 test("testSnippet2", 1); |
92 test("testSnippet2", 1); |
93 } |
93 } |
94 |
94 |
95 private void test(String snippet, int guardCount) { |
95 private void test(String snippet, int guardCount) { |
96 StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES); |
96 StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES); |
97 PhaseContext context = new PhaseContext(getProviders()); |
97 CoreProviders context = getProviders(); |
98 new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context); |
98 new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context); |
99 new ConditionalEliminationPhase(true).apply(graph, context); |
99 new ConditionalEliminationPhase(true).apply(graph, context); |
100 Assert.assertEquals(guardCount, graph.getNodes().filter(GuardNode.class).count()); |
100 Assert.assertEquals(guardCount, graph.getNodes().filter(GuardNode.class).count()); |
101 } |
101 } |
102 } |
102 } |