27 import org.graalvm.compiler.debug.DebugContext; |
27 import org.graalvm.compiler.debug.DebugContext; |
28 import org.graalvm.compiler.nodes.FrameState; |
28 import org.graalvm.compiler.nodes.FrameState; |
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.util.GraphUtil; |
31 import org.graalvm.compiler.nodes.util.GraphUtil; |
32 import org.graalvm.compiler.phases.common.CanonicalizerPhase; |
|
33 import org.junit.Test; |
32 import org.junit.Test; |
34 |
33 |
35 public class PushThroughIfTest extends GraalCompilerTest { |
34 public class PushThroughIfTest extends GraalCompilerTest { |
36 |
35 |
37 public int field1; |
36 public int field1; |
63 debug.dump(DebugContext.BASIC_LEVEL, graph, "Graph"); |
62 debug.dump(DebugContext.BASIC_LEVEL, graph, "Graph"); |
64 for (FrameState fs : graph.getNodes(FrameState.TYPE).snapshot()) { |
63 for (FrameState fs : graph.getNodes(FrameState.TYPE).snapshot()) { |
65 fs.replaceAtUsages(null); |
64 fs.replaceAtUsages(null); |
66 GraphUtil.killWithUnusedFloatingInputs(fs); |
65 GraphUtil.killWithUnusedFloatingInputs(fs); |
67 } |
66 } |
68 new CanonicalizerPhase().apply(graph, getProviders()); |
67 createCanonicalizerPhase().apply(graph, getProviders()); |
69 new CanonicalizerPhase().apply(graph, getProviders()); |
68 createCanonicalizerPhase().apply(graph, getProviders()); |
70 |
69 |
71 StructuredGraph referenceGraph = parseEager(reference, AllowAssumptions.YES); |
70 StructuredGraph referenceGraph = parseEager(reference, AllowAssumptions.YES); |
72 for (FrameState fs : referenceGraph.getNodes(FrameState.TYPE).snapshot()) { |
71 for (FrameState fs : referenceGraph.getNodes(FrameState.TYPE).snapshot()) { |
73 fs.replaceAtUsages(null); |
72 fs.replaceAtUsages(null); |
74 GraphUtil.killWithUnusedFloatingInputs(fs); |
73 GraphUtil.killWithUnusedFloatingInputs(fs); |
75 } |
74 } |
76 new CanonicalizerPhase().apply(referenceGraph, getProviders()); |
75 createCanonicalizerPhase().apply(referenceGraph, getProviders()); |
77 assertEquals(referenceGraph, graph); |
76 assertEquals(referenceGraph, graph); |
78 } |
77 } |
79 } |
78 } |