Index: llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp =================================================================== --- llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -826,9 +826,12 @@ // Create an expression where the register's entry value is used. DIExpression *EntryExpr = DIExpression::get( MF->getFunction().getContext(), {dwarf::DW_OP_LLVM_entry_value, 1}); + const auto &TRI = *MF->getSubtarget().getRegisterInfo(); for (auto RegEntry : ForwardedRegWorklist) { - MachineLocation MLoc(RegEntry.first); - finishCallSiteParams(MLoc, EntryExpr, RegEntry.second, Params); + if (TRI.isCalleeSavedPhysReg(RegEntry.first, *MF)) { + MachineLocation MLoc(RegEntry.first); + finishCallSiteParams(MLoc, EntryExpr, RegEntry.second, Params); + } } } }