src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/EnumSwitchTest.java
equal
deleted
inserted
replaced
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.nodes.java.LoadIndexedNode; |
29 import org.graalvm.compiler.nodes.java.LoadIndexedNode; |
30 import org.graalvm.compiler.options.OptionValues; |
30 import org.graalvm.compiler.options.OptionValues; |
31 import org.graalvm.compiler.phases.Phase; |
31 import org.graalvm.compiler.phases.Phase; |
32 import org.graalvm.compiler.phases.common.RemoveValueProxyPhase; |
|
33 import org.graalvm.compiler.phases.tiers.Suites; |
32 import org.graalvm.compiler.phases.tiers.Suites; |
34 import org.junit.Assume; |
33 import org.junit.Assume; |
35 import org.junit.Test; |
34 import org.junit.Test; |
36 |
35 |
37 public class EnumSwitchTest extends GraalCompilerTest { |
36 public class EnumSwitchTest extends GraalCompilerTest { |
155 @Override |
154 @Override |
156 protected CharSequence getName() { |
155 protected CharSequence getName() { |
157 return "CheckGraphPhase"; |
156 return "CheckGraphPhase"; |
158 } |
157 } |
159 }); |
158 }); |
160 ret.getHighTier().findPhase(RemoveValueProxyPhase.class).add(new Phase() { |
159 ret.getHighTier().addBeforeLast(new Phase() { |
161 @Override |
160 @Override |
162 protected void run(StructuredGraph graph) { |
161 protected void run(StructuredGraph graph) { |
163 /* Re-writing of the switch cases eliminates the array load. */ |
162 /* Re-writing of the switch cases eliminates the array load. */ |
164 assertTrue(graph.getNodes().filter(LoadIndexedNode.class).count() == 0); |
163 assertTrue(graph.getNodes().filter(LoadIndexedNode.class).count() == 0); |
165 /* The switch is still there. */ |
164 /* The switch is still there. */ |