summaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/StackColoring.cpp
diff options
context:
space:
mode:
authorPaul Kirth <paulkirth@google.com>2023-12-15 13:32:39 -0800
committerGitHub <noreply@github.com>2023-12-15 13:32:39 -0800
commit9a578a9f602547bb7b0cdf54d4759eab20d150b3 (patch)
tree2b6a2e1f67e7b2d682b54915c4cc88197bcb3ef2 /llvm/lib/CodeGen/StackColoring.cpp
parent5f423b7d1cb3474168d79827d2305b137be7160b (diff)
Revert "[StackColoring] Delete dead stack slots (#75351)" (#75655)
This reverts commit 08b306dc8e7c0b2498f4f194a3c51686d56dbd20. it causes the following assertion failure: llvm/include/llvm/CodeGen/MachineFrameInfo.h:530: int64_t llvm::MachineFrameInfo::getObjectOffset(int) const: Assertion `!isDeadObjectIndex(ObjectIdx) && "Getting frame offset for a dead object?"' failed.
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 fa01aa17b3a8..37f7aa929005 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);
}