src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/SwitchCanonicalizerTest.java
equal
deleted
inserted
replaced
24 |
24 |
25 package org.graalvm.compiler.core.test; |
25 package org.graalvm.compiler.core.test; |
26 |
26 |
27 import org.graalvm.compiler.nodes.StructuredGraph; |
27 import org.graalvm.compiler.nodes.StructuredGraph; |
28 import org.graalvm.compiler.nodes.extended.IntegerSwitchNode; |
28 import org.graalvm.compiler.nodes.extended.IntegerSwitchNode; |
29 import org.graalvm.compiler.phases.common.CanonicalizerPhase; |
|
30 import org.junit.Test; |
29 import org.junit.Test; |
31 |
30 |
32 public class SwitchCanonicalizerTest extends GraalCompilerTest { |
31 public class SwitchCanonicalizerTest extends GraalCompilerTest { |
33 |
32 |
34 public int divByPowerOf2(int n) { |
33 public int divByPowerOf2(int n) { |
117 shouldFoldSwitch("remByNonPowerOf2"); |
116 shouldFoldSwitch("remByNonPowerOf2"); |
118 } |
117 } |
119 |
118 |
120 private void shouldFoldSwitch(String methodName) { |
119 private void shouldFoldSwitch(String methodName) { |
121 StructuredGraph graph = parseForCompile(getResolvedJavaMethod(methodName)); |
120 StructuredGraph graph = parseForCompile(getResolvedJavaMethod(methodName)); |
122 new CanonicalizerPhase().apply(graph, getDefaultHighTierContext()); |
121 createCanonicalizerPhase().apply(graph, getDefaultHighTierContext()); |
123 assertTrue(graph.getNodes().filter(IntegerSwitchNode.class).isEmpty()); |
122 assertTrue(graph.getNodes().filter(IntegerSwitchNode.class).isEmpty()); |
124 } |
123 } |
125 |
124 |
126 } |
125 } |