diff --git a/llvm/lib/CodeGen/StackSlotColoring.cpp b/llvm/lib/CodeGen/StackSlotColoring.cpp index 9fdc8a338b52a5..9bc28bb680157d 100644 --- a/llvm/lib/CodeGen/StackSlotColoring.cpp +++ b/llvm/lib/CodeGen/StackSlotColoring.cpp @@ -149,6 +149,7 @@ namespace { AU.addRequired(); AU.addPreserved(); AU.addRequired(); + AU.addPreserved(); AU.addRequired(); AU.addPreserved(); AU.addPreservedID(MachineDominatorsID); @@ -534,6 +535,12 @@ bool StackSlotColoring::runOnMachineFunction(MachineFunction &MF) { InitializeSlots(); Changed = ColorSlots(MF); + // Clear LiveStack analysis as it has been changed in ways that it requires + // efforts to rectify which is equivalent to do it all over again. Also, + // this current results would not be used later, so better to clear it & + // preserve analysis. + LS->releaseMemory(); + for (int &Next : NextColors) Next = -1;