[PATCH] D141279: [DebugInfo][CSInfo] Avoid using clobbered registers as call-site argument locations

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 9 05:58:38 PST 2023


jmorse created this revision.
jmorse added reviewers: djtodoro, StephenTozer, Orlando.
Herald added a subscriber: hiraditya.
Herald added a project: All.
jmorse requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

As reported in https://github.com/llvm/llvm-project/issues/57444 , when we build call-site information and find a copy from a non-volatile to a parameter register, the non-volatile shouldn't be an argument location if that register is clobbered between the copy and the call. We need to perform that check for clobbering, or incorrect values could appear in the debugger as entry values.

This patch adds a collection of register units defined as we walk back from the call site, and prevents the acceptance of a call-site parameter location if it's going to be clobbered. It's still possible for a subsequent copy to that location to be accepted, if won't be clobbered. The added test checks this using the reproducer from the bug report.

In terms of call-site coverage, I've built stage2 RelWithDebInfo clang with and without this patch, based on rG2b1d45b227bd <https://reviews.llvm.org/rG2b1d45b227bdbb1f59934905a5204d16ea0d378b>, and there are roughly 5% fewer DW_AT_call_value attributes produced once this patch is applied, which I think we can reasonably conclude were incorrect locations.


https://reviews.llvm.org/D141279

Files:
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-clobbered-regs.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141279.487400.patch
Type: text/x-patch
Size: 13096 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230109/54e17ba5/attachment.bin>


More information about the llvm-commits mailing list