[llvm] [StackColoring] Delete dead stack slots (PR #72633)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 6 20:59:38 PST 2023


================
@@ -1249,8 +1257,15 @@ bool StackColoring::runOnMachineFunction(MachineFunction &Func) {
 
   // Do not bother looking at empty intervals.
   for (unsigned I = 0; I < NumSlots; ++I) {
-    if (Intervals[SortedSlots[I]]->empty())
+    int Slot = SortedSlots[I];
+    if (Intervals[Slot]->empty()) {
+      if (InterestingSlots.test(Slot) && !ConservativeSlots.test(Slot)) {
+        RemovedSlots += 1;
+        ReducedSize += MFI->getObjectSize(Slot);
----------------
arsenm wrote:

The reduced size thing doesn't account for alignment but I guess this is only used for debug printing and was never accurate 

https://github.com/llvm/llvm-project/pull/72633


More information about the llvm-commits mailing list