[PATCH] Generate better location ranges for some register-described variables.

Alexey Samsonov vonosmas at gmail.com
Tue May 27 17:41:54 PDT 2014


Hi dblaikie,

Don't terminate location ranges for register-described variables
at the end of machine basic block if this register is never modified
in the function body (except for the frame setup and the last machine
basic block).

This patch is mostly targeted to fix non-trivial debug locations for
variables addressed via stack and frame pointers (%rsp, %rbp).

It is not really a generic fix. We can still produce poor debug info
for register-described variables if this register *is* modified somewhere
in the function, but in unrelated places. This might be the case for the debug
info in optimized binaries (e.g. for local variables in inlined functions).
However, proper fix requires a control-flow analysis and should probably be
done in a different place (register allocator) and actually modify DBG_VALUE
instructions to keep AsmPrinter straightforward.

I'd like to try and proceed with a fix in this patch, as it is simple
and helps in many important cases, e.g. it is intended to fix completely
broken debug info with AddressSanitizer and fix PR19307 (missing debug info
for by-value std::string arguments at -O0).

http://reviews.llvm.org/D3933

Files:
  lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp
  test/DebugInfo/X86/debug-loc-asan.ll
  test/DebugInfo/X86/pr19307.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3933.9857.patch
Type: text/x-patch
Size: 24408 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140528/372e3097/attachment.bin>


More information about the llvm-commits mailing list