Skip to content

Commit 9c093cb

Browse files
committed
Revert "[StackColoring] Delete dead stack slots (#72633)"
This reverts commit a294578. Causes an assertion failure in llvm/test/DebugInfo/COFF/lexicalblock.ll.
1 parent 6eec801 commit 9c093cb

File tree

5 files changed

+30
-46
lines changed

5 files changed

+30
-46
lines changed

llvm/lib/CodeGen/StackColoring.cpp

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -900,15 +900,6 @@ void StackColoring::remapInstructions(DenseMap<int, int> &SlotRemap) {
900900
unsigned FixedMemOp = 0;
901901
unsigned FixedDbg = 0;
902902

903-
// Remove debug information for deleted slots.
904-
erase_if(MF->getVariableDbgInfo(), [&](auto &VI) {
905-
if (!VI.inStackSlot())
906-
return false;
907-
int Slot = VI.getStackSlot();
908-
return Slot >= 0 && Intervals[Slot]->empty() &&
909-
InterestingSlots.test(Slot) && !ConservativeSlots.test(Slot);
910-
});
911-
912903
// Remap debug information that refers to stack slots.
913904
for (auto &VI : MF->getVariableDbgInfo()) {
914905
if (!VI.Var || !VI.inStackSlot())
@@ -1259,15 +1250,8 @@ bool StackColoring::runOnMachineFunction(MachineFunction &Func) {
12591250

12601251
// Do not bother looking at empty intervals.
12611252
for (unsigned I = 0; I < NumSlots; ++I) {
1262-
int Slot = SortedSlots[I];
1263-
if (Intervals[Slot]->empty()) {
1264-
if (InterestingSlots.test(Slot) && !ConservativeSlots.test(Slot)) {
1265-
RemovedSlots += 1;
1266-
ReducedSize += MFI->getObjectSize(Slot);
1267-
MFI->RemoveStackObject(Slot);
1268-
}
1253+
if (Intervals[SortedSlots[I]]->empty())
12691254
SortedSlots[I] = -1;
1270-
}
12711255
}
12721256

12731257
// This is a simple greedy algorithm for merging allocas. First, sort the

llvm/test/CodeGen/PowerPC/aix32-cc-abi-vaarg.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ entry:
347347

348348
; 32BIT-LABEL: stack:
349349
; 32BIT-DAG: - { id: 0, name: arg1, type: default, offset: 0, size: 4, alignment: 4,
350+
; 32BIT-DAG: - { id: 1, name: arg2, type: default, offset: 0, size: 4, alignment: 4,
350351
; 32BIT-DAG: - { id: 2, name: '', type: default, offset: 0, size: 8, alignment: 8,
351352
; 32BIT-DAG: - { id: 3, name: '', type: default, offset: 0, size: 8, alignment: 8,
352353

llvm/test/CodeGen/PowerPC/aix64-cc-abi-vaarg.ll

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@
138138
; 64BIT-LABEL: fixedStack:
139139
; 64BIT-DAG: - { id: 0, type: default, offset: 112, size: 8, alignment: 16, stack-id: default,
140140

141-
; 64BIT-LABEL: stack: []
141+
; 64BIT-LABEL: stack:
142+
; 64BIT-DAG: - { id: 0, name: arg1, type: default, offset: 0, size: 8, alignment: 8,
143+
; 64BIT-DAG: - { id: 1, name: arg2, type: default, offset: 0, size: 8, alignment: 8,
142144

143145
; 64BIT-LABEL: body: |
144146
; 64BIT-DAG: liveins: $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10
@@ -303,7 +305,9 @@
303305
; 64BIT-LABEL: fixedStack:
304306
; 64BIT-DAG: - { id: 0, type: default, offset: 152, size: 8
305307

306-
; 64BIT-LABEL: stack: []
308+
; 64BIT-LABEL: stack:
309+
; 64BIT-DAG: - { id: 0, name: arg1, type: default, offset: 0, size: 8
310+
; 64BIT-DAG: - { id: 1, name: arg2, type: default, offset: 0, size: 8
307311

308312
; 64BIT-LABEL: body: |
309313
; 64BIT-DAG: liveins: $f1, $f2, $f3, $f4, $f5, $f6, $f7, $f8, $f9, $f10, $f11, $f12, $f13

llvm/test/CodeGen/RISCV/dead-stack-slot.ll

Lines changed: 0 additions & 25 deletions
This file was deleted.

llvm/test/DebugInfo/COFF/lexicalblock.ll

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,32 @@
6363
; CHECK: LocalSym {
6464
; CHECK: VarName: localA
6565
; CHECK: }
66+
; CHECK: LocalSym {
67+
; CHECK: VarName: localB
68+
; CHECK: }
6669
; CHECK: BlockSym {
6770
; CHECK: Kind: S_BLOCK32 {{.*}}
6871
; CHECK: BlockName:
6972
; CHECK: }
70-
; CHECK: LocalSym {
71-
; CHECK: VarName: localB
73+
; CHECK: ScopeEndSym {
74+
; CHECK: Kind: S_END {{.*}}
75+
; CHECK: }
76+
; CHECK: BlockSym {
77+
; CHECK: Kind: S_BLOCK32 {{.*}}
78+
; CHECK: BlockName:
79+
; CHECK: }
80+
; CHECK: ScopeEndSym {
81+
; CHECK: Kind: S_END {{.*}}
82+
; CHECK: }
83+
; CHECK: BlockSym {
84+
; CHECK: Kind: S_BLOCK32 {{.*}}
85+
; CHECK: BlockName:
86+
; CHECK: }
87+
; CHECK: ScopeEndSym {
88+
; CHECK: }
89+
; CHECK: BlockSym {
90+
; CHECK: Kind: S_BLOCK32 {{.*}}
91+
; CHECK: BlockName:
7292
; CHECK: }
7393
; CHECK: ScopeEndSym {
7494
; CHECK: Kind: S_END {{.*}}

0 commit comments

Comments
 (0)