[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:33:31 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:
This heuristic is broken and I've really wanted to fix this for a long time. getNumAllocatableRegs does not understand overlapping registers. What this really should be accounting for is number of independently allocatable registers. Can we fix that instead of just adding a flag to skip the heuristic?
https://github.com/llvm/llvm-project/pull/102160
More information about the llvm-commits
mailing list