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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 package org.graalvm.compiler.core.test;
24
25 import org.graalvm.compiler.debug.Debug;
26 import org.graalvm.compiler.nodes.StructuredGraph;
27 import org.graalvm.compiler.nodes.ValueNode;
28 import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext;
29 import org.graalvm.compiler.nodes.graphbuilderconf.InlineInvokePlugin;
30 import org.graalvm.compiler.phases.common.CanonicalizerPhase;
31 import org.graalvm.compiler.phases.tiers.PhaseContext;
32 import org.junit.Test;
33
34 import jdk.vm.ci.meta.ResolvedJavaMethod;
35
36 public class ConditionalEliminationTest13 extends ConditionalEliminationTestBase {
37
38 @Override
39 protected InlineInvokePlugin.InlineInfo bytecodeParserShouldInlineInvoke(GraphBuilderContext b, ResolvedJavaMethod method, ValueNode[] args) {
40 return InlineInvokePlugin.InlineInfo.createStandardInlineInfo(method);
41 }
42
43 public static void referenceSnippet1(int a) {
44 if (Integer.compareUnsigned(a, a + 1) < 0) {
45 sink1 = 0;
293 @Test
294 public void test12() {
295 testConditionalElimination("testSnippet12", "referenceSnippet12");
296 }
297
298 @Test
299 public void test13() {
300 testConditionalElimination("testSnippet13", "testSnippet13");
301 }
302
303 @Test
304 public void test14() {
305 testConditionalElimination("testSnippet14", "referenceSnippet14");
306 }
307
308 @Override
309 protected void prepareGraph(StructuredGraph graph, CanonicalizerPhase canonicalizer, PhaseContext context, boolean applyLowering) {
310 super.prepareGraph(graph, canonicalizer, context, applyLowering);
311 graph.clearAllStateAfter();
312 graph.setGuardsStage(StructuredGraph.GuardsStage.AFTER_FSA);
313 Debug.dump(Debug.BASIC_LEVEL, graph, "After preparation");
314 canonicalizer.apply(graph, context);
315 }
316 }
|
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 package org.graalvm.compiler.core.test;
24
25 import org.graalvm.compiler.debug.DebugContext;
26 import org.graalvm.compiler.nodes.StructuredGraph;
27 import org.graalvm.compiler.nodes.ValueNode;
28 import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext;
29 import org.graalvm.compiler.nodes.graphbuilderconf.InlineInvokePlugin;
30 import org.graalvm.compiler.phases.common.CanonicalizerPhase;
31 import org.graalvm.compiler.phases.tiers.PhaseContext;
32 import org.junit.Test;
33
34 import jdk.vm.ci.meta.ResolvedJavaMethod;
35
36 public class ConditionalEliminationTest13 extends ConditionalEliminationTestBase {
37
38 @Override
39 protected InlineInvokePlugin.InlineInfo bytecodeParserShouldInlineInvoke(GraphBuilderContext b, ResolvedJavaMethod method, ValueNode[] args) {
40 return InlineInvokePlugin.InlineInfo.createStandardInlineInfo(method);
41 }
42
43 public static void referenceSnippet1(int a) {
44 if (Integer.compareUnsigned(a, a + 1) < 0) {
45 sink1 = 0;
293 @Test
294 public void test12() {
295 testConditionalElimination("testSnippet12", "referenceSnippet12");
296 }
297
298 @Test
299 public void test13() {
300 testConditionalElimination("testSnippet13", "testSnippet13");
301 }
302
303 @Test
304 public void test14() {
305 testConditionalElimination("testSnippet14", "referenceSnippet14");
306 }
307
308 @Override
309 protected void prepareGraph(StructuredGraph graph, CanonicalizerPhase canonicalizer, PhaseContext context, boolean applyLowering) {
310 super.prepareGraph(graph, canonicalizer, context, applyLowering);
311 graph.clearAllStateAfter();
312 graph.setGuardsStage(StructuredGraph.GuardsStage.AFTER_FSA);
313 DebugContext debug = graph.getDebug();
314 debug.dump(DebugContext.BASIC_LEVEL, graph, "After preparation");
315 canonicalizer.apply(graph, context);
316 }
317 }
|