[llvm] [RegAllocEvictAdvisor] Add minimum weight ratio heuristic. (PR #98109)

Quentin Colombet via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 23 03:03:06 PDT 2024


================
@@ -156,8 +163,15 @@ bool DefaultEvictionAdvisor::shouldEvict(const LiveInterval &A, bool IsHint,
   if (CanSplit && IsHint && !BreaksHint)
     return true;
 
-  if (A.weight() > B.weight()) {
-    LLVM_DEBUG(dbgs() << "should evict: " << B << " w= " << B.weight() << '\n');
+  float AWeight = A.weight();
+  float BWeight = B.weight();
+  if (AWeight > BWeight) {
+    float WeightRatio = BWeight == 0.0 ? std::numeric_limits<float>::infinity()
+                                       : AWeight / BWeight;
+    if (CanSplit && !IsHint && BreaksHint &&
----------------
qcolombet wrote:

The `CanSplit` doesn't make much sense to me here.
Could you explain why this is desirable to check for this here?

https://github.com/llvm/llvm-project/pull/98109


More information about the llvm-commits mailing list