[llvm] [GreedyRA] Improve RA for nested loop induction variables (PR #72093)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 13 07:18:39 PST 2023
================
@@ -767,10 +767,27 @@ bool RAGreedy::growRegion(GlobalSplitCandidate &Cand) {
if (Cand.PhysReg) {
if (!addThroughConstraints(Cand.Intf, NewBlocks))
return false;
- } else
- // Provide a strong negative bias on through blocks to prevent unwanted
- // liveness on loop backedges.
- SpillPlacer->addPrefSpill(NewBlocks, /* Strong= */ true);
+ } else {
+ // Providing that the variable being spilled does not look like a loop
+ // induction variable, which is expensive to spill around and better
+ // pushed into a condition inside the loop if possible, provide a strong
+ // negative bias on through blocks to prevent unwanted liveness on loop
+ // backedges.
+ bool PrefSpill = true;
+ if (SA->looksLikeLoopIV() && NewBlocks.size() == 3) {
+ // NewBlocks==3 means we are (possible) adding a Header + start+end of
----------------
qcolombet wrote:
Nit: (possible) => (possibly)
https://github.com/llvm/llvm-project/pull/72093
More information about the llvm-commits
mailing list