src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/StampCanonicalizerTest.java
equal
deleted
inserted
replaced
22 */ |
22 */ |
23 |
23 |
24 |
24 |
25 package org.graalvm.compiler.core.test; |
25 package org.graalvm.compiler.core.test; |
26 |
26 |
27 import org.junit.Test; |
|
28 |
|
29 import org.graalvm.compiler.core.common.type.IntegerStamp; |
27 import org.graalvm.compiler.core.common.type.IntegerStamp; |
30 import org.graalvm.compiler.nodes.StructuredGraph; |
28 import org.graalvm.compiler.nodes.StructuredGraph; |
31 import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions; |
29 import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions; |
32 import org.graalvm.compiler.phases.common.CanonicalizerPhase; |
30 import org.graalvm.compiler.phases.common.CanonicalizerPhase; |
33 import org.graalvm.compiler.phases.common.DeadCodeEliminationPhase; |
31 import org.graalvm.compiler.phases.common.DeadCodeEliminationPhase; |
34 import org.graalvm.compiler.phases.tiers.PhaseContext; |
32 import org.junit.Test; |
35 |
33 |
36 /** |
34 /** |
37 * This class tests some specific patterns the stamp system should be able to canonicalize away |
35 * This class tests some specific patterns the stamp system should be able to canonicalize away |
38 * using {@link IntegerStamp#upMask()}. |
36 * using {@link IntegerStamp#upMask()}. |
39 */ |
37 */ |
111 testZeroReturn("distinctMask"); |
109 testZeroReturn("distinctMask"); |
112 } |
110 } |
113 |
111 |
114 private void testZeroReturn(String methodName) { |
112 private void testZeroReturn(String methodName) { |
115 StructuredGraph graph = parseEager(methodName, AllowAssumptions.YES); |
113 StructuredGraph graph = parseEager(methodName, AllowAssumptions.YES); |
116 new CanonicalizerPhase().apply(graph, new PhaseContext(getProviders())); |
114 new CanonicalizerPhase().apply(graph, getProviders()); |
117 new DeadCodeEliminationPhase().apply(graph); |
115 new DeadCodeEliminationPhase().apply(graph); |
118 assertConstantReturn(graph, 0); |
116 assertConstantReturn(graph, 0); |
119 } |
117 } |
120 } |
118 } |