< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.loop.test/src/org/graalvm/compiler/loop/test/LoopPartialUnrollTest.java

Print this page




 197             fsa.add(partialUnoll);
 198         }
 199         return suites;
 200     }
 201 
 202     public void testGraph(String reference, String test) {
 203         StructuredGraph referenceGraph = buildGraph(reference, false);
 204         StructuredGraph testGraph = buildGraph(test, true);
 205         assertEquals(referenceGraph, testGraph, false, false);
 206     }
 207 
 208     @SuppressWarnings("try")
 209     public StructuredGraph buildGraph(String name, boolean partialUnroll) {
 210         CompilationIdentifier id = new CompilationIdentifier() {
 211             @Override
 212             public String toString(Verbosity verbosity) {
 213                 return name;
 214             }
 215         };
 216         ResolvedJavaMethod method = getResolvedJavaMethod(name);
 217         OptionValues options = new OptionValues(getInitialOptions(), DefaultLoopPolicies.UnrollMaxIterations, 2);
 218         StructuredGraph graph = parse(builder(method, StructuredGraph.AllowAssumptions.YES, id, options), getEagerGraphBuilderSuite());
 219         try (DebugContext.Scope buildScope = graph.getDebug().scope(name, method, graph)) {
 220             MidTierContext context = new MidTierContext(getProviders(), getTargetProvider(), OptimisticOptimizations.ALL, null);
 221 
 222             CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
 223             canonicalizer.apply(graph, context);
 224             new RemoveValueProxyPhase().apply(graph);
 225             new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
 226             new FloatingReadPhase().apply(graph);
 227             new DeadCodeEliminationPhase().apply(graph);
 228             new ConditionalEliminationPhase(true).apply(graph, context);
 229             ComputeLoopFrequenciesClosure.compute(graph);
 230             new GuardLoweringPhase().apply(graph, context);
 231             new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.MID_TIER).apply(graph, context);
 232             new FrameStateAssignmentPhase().apply(graph);
 233             new DeoptimizationGroupingPhase().apply(graph, context);
 234             canonicalizer.apply(graph, context);
 235             new ConditionalEliminationPhase(true).apply(graph, context);
 236             if (partialUnroll) {
 237                 LoopsData dataCounted = new LoopsData(graph);




 197             fsa.add(partialUnoll);
 198         }
 199         return suites;
 200     }
 201 
 202     public void testGraph(String reference, String test) {
 203         StructuredGraph referenceGraph = buildGraph(reference, false);
 204         StructuredGraph testGraph = buildGraph(test, true);
 205         assertEquals(referenceGraph, testGraph, false, false);
 206     }
 207 
 208     @SuppressWarnings("try")
 209     public StructuredGraph buildGraph(String name, boolean partialUnroll) {
 210         CompilationIdentifier id = new CompilationIdentifier() {
 211             @Override
 212             public String toString(Verbosity verbosity) {
 213                 return name;
 214             }
 215         };
 216         ResolvedJavaMethod method = getResolvedJavaMethod(name);
 217         OptionValues options = new OptionValues(getInitialOptions(), DefaultLoopPolicies.Options.UnrollMaxIterations, 2);
 218         StructuredGraph graph = parse(builder(method, StructuredGraph.AllowAssumptions.YES, id, options), getEagerGraphBuilderSuite());
 219         try (DebugContext.Scope buildScope = graph.getDebug().scope(name, method, graph)) {
 220             MidTierContext context = new MidTierContext(getProviders(), getTargetProvider(), OptimisticOptimizations.ALL, null);
 221 
 222             CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
 223             canonicalizer.apply(graph, context);
 224             new RemoveValueProxyPhase().apply(graph);
 225             new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
 226             new FloatingReadPhase().apply(graph);
 227             new DeadCodeEliminationPhase().apply(graph);
 228             new ConditionalEliminationPhase(true).apply(graph, context);
 229             ComputeLoopFrequenciesClosure.compute(graph);
 230             new GuardLoweringPhase().apply(graph, context);
 231             new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.MID_TIER).apply(graph, context);
 232             new FrameStateAssignmentPhase().apply(graph);
 233             new DeoptimizationGroupingPhase().apply(graph, context);
 234             canonicalizer.apply(graph, context);
 235             new ConditionalEliminationPhase(true).apply(graph, context);
 236             if (partialUnroll) {
 237                 LoopsData dataCounted = new LoopsData(graph);


< prev index next >