@@ -63,11 +63,11 @@ static cl::opt<std::string> InteractiveChannelBaseName(
63
63
" outgoing name should be "
64
64
" <regalloc-evict-interactive-channel-base>.out" ));
65
65
66
- static cl::opt<unsigned > MaxEvictionCount (
67
- " mlregalloc-max-eviction-count " , cl::Hidden,
68
- cl::desc (" The maximum number of times a live range can be "
69
- " evicted before preventing it from being evicted" ),
70
- cl::init(100 ));
66
+ static cl::opt<unsigned >
67
+ MaxCascade ( " mlregalloc-max-cascade " , cl::Hidden,
68
+ cl::desc (" The maximum number of times a live range can be "
69
+ " evicted before preventing it from being evicted" ),
70
+ cl::init(20 ));
71
71
72
72
// Options that only make sense in development mode
73
73
#ifdef LLVM_HAVE_TFLITE
@@ -364,22 +364,6 @@ class MLEvictAdvisor : public RegAllocEvictionAdvisor {
364
364
365
365
using RegID = unsigned ;
366
366
mutable DenseMap<RegID, LIFeatureComponents> CachedFeatures;
367
-
368
- mutable std::unordered_map<unsigned , unsigned > VirtRegEvictionCounts;
369
-
370
- void onEviction (Register RegBeingEvicted) const {
371
- // If we cannot find the virtual register in the map, we just assume it has
372
- // not been evicted before and thus has a value of zero (which is what the
373
- // subscript operator returns by default).
374
- ++VirtRegEvictionCounts[RegBeingEvicted.id ()];
375
- }
376
-
377
- unsigned getEvictionCount (Register Reg) const {
378
- auto EvictionCountIt = VirtRegEvictionCounts.find (Reg.id ());
379
- if (EvictionCountIt != VirtRegEvictionCounts.end ())
380
- return EvictionCountIt->second ;
381
- return 0 ;
382
- }
383
367
};
384
368
385
369
#define _DECL_FEATURES (type, name, shape, _ ) \
@@ -673,7 +657,7 @@ bool MLEvictAdvisor::loadInterferenceFeatures(
673
657
// threshold, prevent the range from being evicted. We still let the
674
658
// range through if it is urgent as we are required to produce an
675
659
// eviction if the candidate is not spillable.
676
- if (getEvictionCount (Intf-> reg ()) > MaxEvictionCount && !Urgent)
660
+ if (IntfCascade >= MaxCascade && !Urgent)
677
661
return false ;
678
662
679
663
// Only evict older cascades or live ranges without a cascade.
@@ -819,22 +803,6 @@ MCRegister MLEvictAdvisor::tryFindEvictionCandidate(
819
803
}
820
804
assert (CandidatePos < ValidPosLimit);
821
805
(void )ValidPosLimit;
822
-
823
- // Update information about how many times the virtual registers being
824
- // evicted have been evicted so that we can prevent the model from evicting
825
- // the same ranges continually and eating compile time.
826
- if (CandidatePos == CandidateVirtRegPos) {
827
- onEviction (VirtReg.reg ());
828
- } else {
829
- for (MCRegUnit Unit : TRI->regunits (Regs[CandidatePos].first )) {
830
- LiveIntervalUnion::Query &Q = Matrix->query (VirtReg, Unit);
831
- const auto &IFIntervals = Q.interferingVRegs (EvictInterferenceCutoff);
832
- for (const LiveInterval *Intf : reverse (IFIntervals)) {
833
- onEviction (Intf->reg ());
834
- }
835
- }
836
- }
837
-
838
806
return Regs[CandidatePos].first ;
839
807
}
840
808
0 commit comments