|
25 | 25 | package org.graalvm.compiler.phases.common;
|
26 | 26 |
|
27 | 27 | import static org.graalvm.compiler.phases.common.CanonicalizerPhase.CanonicalizerFeature.CFG_SIMPLIFICATION;
|
| 28 | +import static org.graalvm.compiler.phases.common.CanonicalizerPhase.CanonicalizerFeature.DEAD_PHI_CYCLE_DETECTION; |
28 | 29 | import static org.graalvm.compiler.phases.common.CanonicalizerPhase.CanonicalizerFeature.GVN;
|
29 | 30 | import static org.graalvm.compiler.phases.common.CanonicalizerPhase.CanonicalizerFeature.READ_CANONICALIZATION;
|
30 | 31 |
|
@@ -108,7 +109,13 @@ public enum CanonicalizerFeature {
|
108 | 109 | * Determines if the canonicalizer is allowed to perform global value numbering. See
|
109 | 110 | * {@link StructuredGraph#findDuplicate(Node)} for details.
|
110 | 111 | */
|
111 |
| - GVN; |
| 112 | + GVN, |
| 113 | + /** |
| 114 | + * Determines if the canonicalizer is allowed to perform a global graph analysis on dead |
| 115 | + * loop phi cycles and delete them. |
| 116 | + * {@link CanonicalizerPhase#isDeadLoopPhiCycle(PhiNode, NodeFlood)} for details. |
| 117 | + */ |
| 118 | + DEAD_PHI_CYCLE_DETECTION; |
112 | 119 | }
|
113 | 120 |
|
114 | 121 | protected static final int MAX_ITERATION_PER_NODE = 10;
|
@@ -158,6 +165,12 @@ public CanonicalizerPhase copyWithoutGVN() {
|
158 | 165 | return new CanonicalizerPhase(customSimplification, newFeatures);
|
159 | 166 | }
|
160 | 167 |
|
| 168 | + public CanonicalizerPhase copyWithoutDeadPhiCycleDetection() { |
| 169 | + EnumSet<CanonicalizerFeature> newFeatures = EnumSet.copyOf(features); |
| 170 | + newFeatures.remove(DEAD_PHI_CYCLE_DETECTION); |
| 171 | + return new CanonicalizerPhase(customSimplification, newFeatures); |
| 172 | + } |
| 173 | + |
161 | 174 | public CanonicalizerPhase copyWithoutSimplification() {
|
162 | 175 | EnumSet<CanonicalizerFeature> newFeatures = EnumSet.copyOf(features);
|
163 | 176 | newFeatures.remove(CFG_SIMPLIFICATION);
|
@@ -314,7 +327,7 @@ public void usagesDroppedToZero(Node node) {
|
314 | 327 | for (Node n : tool.workList) {
|
315 | 328 | processNode(n, tool);
|
316 | 329 | ++sum;
|
317 |
| - if (tool.allUsagesAvailable() && n.isAlive() && n instanceof PhiNode && ((PhiNode) n).isLoopPhi()) { |
| 330 | + if (features.contains(DEAD_PHI_CYCLE_DETECTION) && tool.allUsagesAvailable() && n.isAlive() && n instanceof PhiNode && ((PhiNode) n).isLoopPhi()) { |
318 | 331 | if (phiPostProcessingWorkList == null) {
|
319 | 332 | phiPostProcessingWorkList = EconomicSet.create();
|
320 | 333 | }
|
|
0 commit comments