src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CompareCanonicalizerTest.java
changeset 58877 aec7bf35d6f5
parent 58299 6df94ce3ab2f
equal deleted inserted replaced
58876:1a8d65e71a66 58877:aec7bf35d6f5
    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.ValueNode;
    31 import org.graalvm.compiler.nodes.ValueNode;
    32 import org.graalvm.compiler.nodes.calc.ConditionalNode;
    32 import org.graalvm.compiler.nodes.calc.ConditionalNode;
    33 import org.graalvm.compiler.nodes.calc.IntegerTestNode;
    33 import org.graalvm.compiler.nodes.calc.IntegerTestNode;
    34 import org.graalvm.compiler.phases.common.CanonicalizerPhase;
       
    35 import org.junit.Test;
    34 import org.junit.Test;
    36 
    35 
    37 public class CompareCanonicalizerTest extends GraalCompilerTest {
    36 public class CompareCanonicalizerTest extends GraalCompilerTest {
    38 
    37 
    39     private StructuredGraph getCanonicalizedGraph(String name) {
    38     private StructuredGraph getCanonicalizedGraph(String name) {
    40         StructuredGraph graph = parseEager(name, AllowAssumptions.YES);
    39         StructuredGraph graph = parseEager(name, AllowAssumptions.YES);
    41         new CanonicalizerPhase().apply(graph, getProviders());
    40         createCanonicalizerPhase().apply(graph, getProviders());
    42         return graph;
    41         return graph;
    43     }
    42     }
    44 
    43 
    45     private static ValueNode getResult(StructuredGraph graph) {
    44     private static ValueNode getResult(StructuredGraph graph) {
    46         assertTrue(graph.start().next() instanceof ReturnNode);
    45         assertTrue(graph.start().next() instanceof ReturnNode);
    53         StructuredGraph referenceGraph = parseEager("referenceCanonicalComparison", AllowAssumptions.NO);
    52         StructuredGraph referenceGraph = parseEager("referenceCanonicalComparison", AllowAssumptions.NO);
    54         for (int i = 1; i < 4; i++) {
    53         for (int i = 1; i < 4; i++) {
    55             StructuredGraph graph = parseEager("canonicalCompare" + i, AllowAssumptions.NO);
    54             StructuredGraph graph = parseEager("canonicalCompare" + i, AllowAssumptions.NO);
    56             assertEquals(referenceGraph, graph);
    55             assertEquals(referenceGraph, graph);
    57         }
    56         }
    58         new CanonicalizerPhase().apply(referenceGraph, getProviders());
    57         createCanonicalizerPhase().apply(referenceGraph, getProviders());
    59         for (int i = 1; i < 4; i++) {
    58         for (int i = 1; i < 4; i++) {
    60             StructuredGraph graph = getCanonicalizedGraph("canonicalCompare" + i);
    59             StructuredGraph graph = getCanonicalizedGraph("canonicalCompare" + i);
    61             assertEquals(referenceGraph, graph);
    60             assertEquals(referenceGraph, graph);
    62         }
    61         }
    63     }
    62     }