aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/PrologEpilogInserter.cpp
diff options
context:
space:
mode:
authorJay Foad <jay.foad@amd.com>2023-11-08 09:49:07 +0000
committerGitHub <noreply@github.com>2023-11-08 09:49:07 +0000
commitd5f3b3b3b188d17aa8a2227d31e8fd7611d7dfff (patch)
treec88ad97b9014d88cdbdc31ac6aeae37877ae9d9f /llvm/lib/CodeGen/PrologEpilogInserter.cpp
parente6a94dca38d77db2678366c55bb7b72cfa312487 (diff)
downloadllvm-d5f3b3b3b188d17aa8a2227d31e8fd7611d7dfff.zip
llvm-d5f3b3b3b188d17aa8a2227d31e8fd7611d7dfff.tar.gz
llvm-d5f3b3b3b188d17aa8a2227d31e8fd7611d7dfff.tar.bz2
[RegScavenger] Simplify state tracking for backwards scavenging (#71202)
Track the live register state immediately before, instead of after, MBBI. This makes it simple to track the state at the start or end of a basic block without a separate (and poorly named) Tracking flag. This changes the API of the backward(MachineBasicBlock::iterator I) method, which now recedes to the state just before, instead of just after, *I. Some clients are simplified by this change. There is one small functional change shown in the lit tests where multiple spilled registers all need to be reloaded before the same instruction. The reloads will now be inserted in the opposite order. This should not affect correctness.
Diffstat (limited to 'llvm/lib/CodeGen/PrologEpilogInserter.cpp')
-rw-r--r--llvm/lib/CodeGen/PrologEpilogInserter.cpp7
1 files changed, 1 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/llvm/lib/CodeGen/PrologEpilogInserter.cpp
index 0b8dcdc..8af17e6 100644
--- a/llvm/lib/CodeGen/PrologEpilogInserter.cpp
+++ b/llvm/lib/CodeGen/PrologEpilogInserter.cpp
@@ -1499,7 +1499,7 @@ void PEI::replaceFrameIndicesBackward(MachineBasicBlock *BB,
// Step backwards to get the liveness state at (immedately after) MI.
if (LocalRS)
- LocalRS->backward(MI);
+ LocalRS->backward(I);
bool RemovedMI = false;
for (const auto &[Idx, Op] : enumerate(MI.operands())) {
@@ -1515,11 +1515,6 @@ void PEI::replaceFrameIndicesBackward(MachineBasicBlock *BB,
break;
}
- // Refresh the scavenger's internal iterator in case MI was removed or more
- // instructions were inserted after it.
- if (LocalRS)
- LocalRS->skipTo(std::prev(I));
-
if (!RemovedMI)
--I;
}