Skip to content

Commit 76f2589

Browse files
[MLGO] Do not include urgent LRs in max cascade calculation (#120052)
A previous PR introduced a threshold where we would mask out a LR that had been evicted a certain number of times to combat pathological compile time cases with a somewhat adversarial model. However, this patch did not take into account urgent LRs which led to compilation failures when greedy would expect us to provide an eviction and we could not due to the newly introduced logic.
1 parent 5c5f669 commit 76f2589

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

llvm/lib/CodeGen/MLRegAllocEvictAdvisor.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,8 +654,10 @@ bool MLEvictAdvisor::loadInterferenceFeatures(
654654
// There is a potential that the model could be adversarial and
655655
// continually evict live ranges over and over again, leading to a
656656
// large amount of compile time being spent in regalloc. If we hit the
657-
// threshold, prevent the range from being evicted.
658-
if (IntfCascade >= MaxCascade)
657+
// threshold, prevent the range from being evicted. We still let the
658+
// range through if it is urgent as we are required to produce an
659+
// eviction if the candidate is not spillable.
660+
if (IntfCascade >= MaxCascade && !Urgent)
659661
return false;
660662

661663
// Only evict older cascades or live ranges without a cascade.

0 commit comments

Comments
 (0)