[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:30:31 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:

@arsenm , is this change considering that getCopyCost may return -1 to indicate "extremely high cost".
IIUC that actually would result in subtracting 10 instead of adding a huge penalty here.

(Context is that I'm debugging some downstream problems, as we've been seeing a number of "ran out of registers" failures after merging this PR. Haven't gotten that far in the debugging yet. But the question above popped up.)

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


More information about the llvm-commits mailing list