[PATCH] Ensure debug info for two calls to the same function from the same location are not merged

David Blaikie dblaikie at gmail.com
Mon Nov 24 12:32:12 PST 2014


Hi dexonsmith, echristo, aprantl,

Starting in r176895 Clang began including column information on function calls in an attempt to fix inline debug info - if two calls from the same location (prior to r176895 this meant the same line, after r176895 it meant the same line and column) were both inlined, they'd get coalesced and treated as a single inline call ({call location} x {original location} was the uniqueness used to differentiate callers, if this was the same, they were the same call).

This solution (doubly so after it was narrowed in r177164) is incomplete (it wasn't applied to constructor calls (where it is still causing issues, such as the one worked around in r220923/PR21408) or member function calls) and insufficient: in the worst case, two calls from within a macro will be attributed to both the same line and column. It also produces possibly surprising and unintended side effects by adding column information to calls (increasing debug info size, surprising debuggers that aren't necessarily ready to cope with this, increasing the size of line tables, etc).

So, I present herein, a more robust solution to the problem. When inlining, uniquely identify the metadata associated with the inlined location ("InlinedAt") by adding an extra field to the end with a circular reference. In this way no two callers can be conflated together.

Once this is committed, I'll remove the hacks/workarounds from Clang. (& there's a test in Clang (test/CodeGenCXX/debug-info-same-line.cpp) that's currently testing this stuff in LLVM, so it'll need to be changed at the same time as this LLVM change (or removed/modified before it))

http://reviews.llvm.org/D6390

Files:
  lib/Transforms/Utils/InlineFunction.cpp
  test/DebugInfo/inline-debug-info-multiret.ll
  test/DebugInfo/inline-debug-info.ll
  test/DebugInfo/inline-no-debug-info.ll
  test/Transforms/Inline/debug-info-duplicate-calls.ll
  test/Transforms/Inline/debug-invoke.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6390.16575.patch
Type: text/x-patch
Size: 14346 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141124/a46d1d7f/attachment.bin>


More information about the llvm-commits mailing list