src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/MergeCanonicalizerTest.java
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 52910 583fd71c47d6
child 58679 9c3209ff7550
equal deleted inserted replaced
58677:13588c901957 58678:9cf78a70fa4f
     1 /*
     1 /*
     2  * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    30 import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
    30 import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
    31 import org.graalvm.compiler.phases.OptimisticOptimizations;
    31 import org.graalvm.compiler.phases.OptimisticOptimizations;
    32 import org.graalvm.compiler.phases.OptimisticOptimizations.Optimization;
    32 import org.graalvm.compiler.phases.OptimisticOptimizations.Optimization;
    33 import org.graalvm.compiler.phases.common.CanonicalizerPhase;
    33 import org.graalvm.compiler.phases.common.CanonicalizerPhase;
    34 import org.graalvm.compiler.phases.tiers.HighTierContext;
    34 import org.graalvm.compiler.phases.tiers.HighTierContext;
    35 import org.graalvm.compiler.phases.tiers.PhaseContext;
       
    36 import org.junit.Test;
    35 import org.junit.Test;
    37 
    36 
    38 public class MergeCanonicalizerTest extends GraalCompilerTest {
    37 public class MergeCanonicalizerTest extends GraalCompilerTest {
    39 
    38 
    40     /**
    39     /**
    69         return v;
    68         return v;
    70     }
    69     }
    71 
    70 
    72     private void testReturnCount(String snippet, int returnCount) {
    71     private void testReturnCount(String snippet, int returnCount) {
    73         StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES);
    72         StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES);
    74         new CanonicalizerPhase().apply(graph, new PhaseContext(getProviders()));
    73         new CanonicalizerPhase().apply(graph, getProviders());
    75         new CanonicalizerPhase().apply(graph, new PhaseContext(getProviders()));
    74         new CanonicalizerPhase().apply(graph, getProviders());
    76         graph.getDebug().dump(DebugContext.BASIC_LEVEL, graph, "Graph");
    75         graph.getDebug().dump(DebugContext.BASIC_LEVEL, graph, "Graph");
    77         assertDeepEquals(returnCount, graph.getNodes(ReturnNode.TYPE).count());
    76         assertDeepEquals(returnCount, graph.getNodes(ReturnNode.TYPE).count());
    78     }
    77     }
    79 }
    78 }