aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/StackColoring.cpp
diff options
context:
space:
mode:
authorPaul Kirth <paulkirth@google.com>2023-12-15 10:38:10 -0800
committerGitHub <noreply@github.com>2023-12-15 10:38:10 -0800
commit6e996033dd3f68330f7ccc5eb2c368ebd8158959 (patch)
tree8a3bf61c625db249de5fb2ed3eb2b9a76990cdca /llvm/lib/CodeGen/StackColoring.cpp
parent59f7f35a9047cccded7b8d3a01926e03f1e10efa (diff)
downloadllvm-6e996033dd3f68330f7ccc5eb2c368ebd8158959.zip
llvm-6e996033dd3f68330f7ccc5eb2c368ebd8158959.tar.gz
llvm-6e996033dd3f68330f7ccc5eb2c368ebd8158959.tar.bz2
Revert "[StackColoring] Delete dead stack slots (#75351)"revert-75351-ussc
This reverts commit 08b306dc8e7c0b2498f4f194a3c51686d56dbd20.
Diffstat (limited to 'llvm/lib/CodeGen/StackColoring.cpp')
-rw-r--r--llvm/lib/CodeGen/StackColoring.cpp20
1 files changed, 2 insertions, 18 deletions
diff --git a/llvm/lib/CodeGen/StackColoring.cpp b/llvm/lib/CodeGen/StackColoring.cpp
index fa01aa1..37f7aa9 100644
--- a/llvm/lib/CodeGen/StackColoring.cpp
+++ b/llvm/lib/CodeGen/StackColoring.cpp
@@ -900,15 +900,6 @@ void StackColoring::remapInstructions(DenseMap<int, int> &SlotRemap) {
unsigned FixedMemOp = 0;
unsigned FixedDbg = 0;
- // Remove debug information for deleted slots.
- erase_if(MF->getVariableDbgInfo(), [&](auto &VI) {
- if (!VI.inStackSlot())
- return false;
- int Slot = VI.getStackSlot();
- return Slot >= 0 && Intervals[Slot]->empty() &&
- InterestingSlots.test(Slot) && !ConservativeSlots.test(Slot);
- });
-
// Remap debug information that refers to stack slots.
for (auto &VI : MF->getVariableDbgInfo()) {
if (!VI.Var || !VI.inStackSlot())
@@ -1259,15 +1250,8 @@ bool StackColoring::runOnMachineFunction(MachineFunction &Func) {
// Do not bother looking at empty intervals.
for (unsigned I = 0; I < NumSlots; ++I) {
- int Slot = SortedSlots[I];
- if (Intervals[Slot]->empty()) {
- if (InterestingSlots.test(Slot) && !ConservativeSlots.test(Slot)) {
- RemovedSlots += 1;
- ReducedSize += MFI->getObjectSize(Slot);
- MFI->RemoveStackObject(Slot);
- }
+ if (Intervals[SortedSlots[I]]->empty())
SortedSlots[I] = -1;
- }
}
// This is a simple greedy algorithm for merging allocas. First, sort the
@@ -1355,7 +1339,7 @@ bool StackColoring::runOnMachineFunction(MachineFunction &Func) {
// Scan the entire function and update all machine operands that use frame
// indices to use the remapped frame index.
- if (RemovedSlots > 0) {
+ if (!SlotRemap.empty()) {
expungeSlotMap(SlotRemap, NumSlots);
remapInstructions(SlotRemap);
}