diff --git a/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/llvm/lib/CodeGen/PrologEpilogInserter.cpp --- a/llvm/lib/CodeGen/PrologEpilogInserter.cpp +++ b/llvm/lib/CodeGen/PrologEpilogInserter.cpp @@ -1230,6 +1230,10 @@ if (OnlyUsed) for (const MachineBasicBlock &MBB : MF) for (const MachineInstr &MI : MBB) + // skip debug instructions + if (MI.isDebugInstr()) + continue; + for (const MachineOperand &MO : MI.operands()) { if (!MO.isReg()) continue;