[llvm] [GreedyRA]: Add flag to force local assignment heuristics (PR #102160)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 6 10:47:07 PDT 2024


================
@@ -321,10 +327,12 @@ unsigned DefaultPriorityAdvisor::getPriority(const LiveInterval &LI) const {
     // Giant live ranges fall back to the global assignment heuristic, which
     // prevents excessive spilling in pathological cases.
     const TargetRegisterClass &RC = *MRI->getRegClass(Reg);
-    bool ForceGlobal = RC.GlobalPriority ||
-                       (!ReverseLocalAssignment &&
-                        (Size / SlotIndex::InstrDist) >
-                            (2 * RegClassInfo.getNumAllocatableRegs(&RC)));
+
+    bool ForceGlobal =
+        RC.GlobalPriority ||
+        (!GreedyForceLocalAssignment && !ReverseLocalAssignment &&
+         (Size / SlotIndex::InstrDist) >
+             (2 * RegClassInfo.getNumAllocatableRegs(&RC)));
----------------
arsenm wrote:

No, I think this heuristic is just broken and is not a point for customization. It just happens to work for CPUs that don't have dense register files. It should work exactly the same for CPU targets if it were in terms of independently allocatable registers 

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


More information about the llvm-commits mailing list