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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 2 08:21:57 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();
----------------
arsenm wrote:

All of the in-tree cases using -1 copy costs appear to be cargo-cult application to non-allocatable physical registers. The only place making use of the negative cost check is in InstrEmitter, which is probably better served by a non-allocatable check. I actually see a number of test improvements when I swap this out for the direct allocatability check 

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


More information about the llvm-commits mailing list