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. |
26 |
26 |
27 import org.graalvm.compiler.debug.DebugContext; |
27 import org.graalvm.compiler.debug.DebugContext; |
28 import org.graalvm.compiler.debug.DebugDumpScope; |
28 import org.graalvm.compiler.debug.DebugDumpScope; |
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.phases.common.CanonicalizerPhase; |
|
32 import org.graalvm.compiler.phases.tiers.HighTierContext; |
31 import org.graalvm.compiler.phases.tiers.HighTierContext; |
33 import org.junit.Test; |
32 import org.junit.Test; |
34 |
33 |
35 /** |
34 /** |
36 * In the following tests, the usages of local variable "a" are replaced with the integer constant |
35 * In the following tests, the usages of local variable "a" are replaced with the integer constant |
83 DebugContext debug = getDebugContext(); |
82 DebugContext debug = getDebugContext(); |
84 try (DebugContext.Scope s = debug.scope("DegeneratedLoopsTest", new DebugDumpScope(snippet))) { |
83 try (DebugContext.Scope s = debug.scope("DegeneratedLoopsTest", new DebugDumpScope(snippet))) { |
85 StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES); |
84 StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES); |
86 HighTierContext context = getDefaultHighTierContext(); |
85 HighTierContext context = getDefaultHighTierContext(); |
87 createInliningPhase().apply(graph, context); |
86 createInliningPhase().apply(graph, context); |
88 new CanonicalizerPhase().apply(graph, context); |
87 createCanonicalizerPhase().apply(graph, context); |
89 debug.dump(DebugContext.BASIC_LEVEL, graph, "Graph"); |
88 debug.dump(DebugContext.BASIC_LEVEL, graph, "Graph"); |
90 StructuredGraph referenceGraph = parseEager(REFERENCE_SNIPPET, AllowAssumptions.YES); |
89 StructuredGraph referenceGraph = parseEager(REFERENCE_SNIPPET, AllowAssumptions.YES); |
91 debug.dump(DebugContext.BASIC_LEVEL, referenceGraph, "ReferenceGraph"); |
90 debug.dump(DebugContext.BASIC_LEVEL, referenceGraph, "ReferenceGraph"); |
92 assertEquals(referenceGraph, graph); |
91 assertEquals(referenceGraph, graph); |
93 } catch (Throwable e) { |
92 } catch (Throwable e) { |