diff --git a/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp b/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp index f557ccddb47..143b0135c8c 100644 --- a/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp +++ b/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp @@ -152,10 +152,11 @@ static void collectChangingRegs(const MachineFunction *MF, std::set &Regs) { for (const auto &MBB : *MF) { auto FirstEpilogueInst = getFirstEpilogueInst(MBB); - bool IsInEpilogue = false; + for (const auto &MI : MBB) { - IsInEpilogue |= &MI == FirstEpilogueInst; - if (!MI.getFlag(MachineInstr::FrameSetup) && !IsInEpilogue) + if (&MI == FirstEpilogueInst) + break; + if (!MI.getFlag(MachineInstr::FrameSetup)) collectClobberedRegisters(MI, TRI, Regs); } }