Index: llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp =================================================================== --- llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -706,20 +706,21 @@ // If the MI is an instruction defining one or more parameters' forwarding // registers, add those defines. - auto getForwardingRegsDefinedByMI = [&](const MachineInstr &MI, - SmallSetVector &Defs) { - if (MI.isDebugInstr()) - return; - - for (const MachineOperand &MO : MI.operands()) { - if (MO.isReg() && MO.isDef() && - Register::isPhysicalRegister(MO.getReg())) { - for (auto FwdReg : ForwardedRegWorklist) - if (TRI->regsOverlap(FwdReg.first, MO.getReg())) - Defs.insert(FwdReg.first); - } - } - }; + auto getForwardingRegsDefinedByMI = + [&TRI](const MachineInstr &MI, SmallSetVector &Defs, + const FwdRegWorklist &ForwardedRegWorklist) { + if (MI.isDebugInstr()) + return; + + for (const MachineOperand &MO : MI.operands()) { + if (MO.isReg() && MO.isDef() && + Register::isPhysicalRegister(MO.getReg())) { + for (auto FwdReg : ForwardedRegWorklist) + if (TRI->regsOverlap(FwdReg.first, MO.getReg())) + Defs.insert(FwdReg.first); + } + } + }; // Search for a loading value in forwarding registers. for (; I != MBB->rend(); ++I) { @@ -738,7 +739,7 @@ // Set of worklist registers that are defined by this instruction. SmallSetVector FwdRegDefs; - getForwardingRegsDefinedByMI(*I, FwdRegDefs); + getForwardingRegsDefinedByMI(*I, FwdRegDefs, ForwardedRegWorklist); if (FwdRegDefs.empty()) continue;