[llvm] Greedy: Make eviction broken hint cost use CopyCost units (PR #160084)

Björn Pettersson via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 29 07:43:50 PDT 2025


================
@@ -300,12 +300,14 @@ bool DefaultEvictionAdvisor::canEvictInterferenceBasedOnCost(
           return false;
         // We permit breaking cascades for urgent evictions. It should be the
         // last resort, though, so make it really expensive.
-        Cost.BrokenHints += 10;
+        Cost.BrokenHints += 10 * MRI->getRegClass(Intf->reg())->getCopyCost();
----------------
bjope wrote:

I tried a hack when I changed all three getCopyCost() calls added here to basically do this (pseudo code),
 `getCopyCost() < 0 ? 100 : getCopyCost()`
and then at least the "ran out of registers" fault I was looking at disappeared (and I got the same result as before this patch).

Our target has some quad-registers that we define with `CopyCost=-1`. So I figure that is what caused the problem here.

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


More information about the llvm-commits mailing list