Skip to content

Commit 5cecedb

Browse files
committed
[GR-49508] [GR-49654] Backport to 23.0 : Refactor NI Optimization Levels.
PullRequest: graal/15873
2 parents f57a072 + 7434dd0 commit 5cecedb

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

compiler/src/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/CanonicalizerPhase.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
package org.graalvm.compiler.phases.common;
2626

2727
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;
2829
import static org.graalvm.compiler.phases.common.CanonicalizerPhase.CanonicalizerFeature.GVN;
2930
import static org.graalvm.compiler.phases.common.CanonicalizerPhase.CanonicalizerFeature.READ_CANONICALIZATION;
3031

@@ -108,7 +109,13 @@ public enum CanonicalizerFeature {
108109
* Determines if the canonicalizer is allowed to perform global value numbering. See
109110
* {@link StructuredGraph#findDuplicate(Node)} for details.
110111
*/
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;
112119
}
113120

114121
protected static final int MAX_ITERATION_PER_NODE = 10;
@@ -158,6 +165,12 @@ public CanonicalizerPhase copyWithoutGVN() {
158165
return new CanonicalizerPhase(customSimplification, newFeatures);
159166
}
160167

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+
161174
public CanonicalizerPhase copyWithoutSimplification() {
162175
EnumSet<CanonicalizerFeature> newFeatures = EnumSet.copyOf(features);
163176
newFeatures.remove(CFG_SIMPLIFICATION);
@@ -314,7 +327,7 @@ public void usagesDroppedToZero(Node node) {
314327
for (Node n : tool.workList) {
315328
processNode(n, tool);
316329
++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()) {
318331
if (phiPostProcessingWorkList == null) {
319332
phiPostProcessingWorkList = EconomicSet.create();
320333
}

0 commit comments

Comments
 (0)