[PATCH] D35637: Fixing an issue with mixing functions from debug and non-debug CUs

Wolfgang Pieb via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 19 11:23:56 PDT 2017


wolfgangp created this revision.
Herald added a subscriber: mehdi_amini.

This patch is addressing a problem that occurs when we are combining debug-translation units with non-debug translation units (most notably with LTO).

In LexicalScopes::initialize() in lib/CodeGen/LexicalScopes.cpp we don't reset the LexicalScopes object when a function from a non-debug translation (or rather, compilation) unit is processed. This leaves some residual pointers around, most notably one pointing to the previous function's MachineFunction object. Subsequently, LiveDebugValues may get confused (and assert) later when it is processing the non-debug function and sees a seemingly valid LexicalScopes object,  especially one pointing to a machine function object, whose memory may have been re-used for the current function.

The fix is 2-fold:

1. Reset the LexicalScopes object in all cases, debug or no.
2. Make LiveDebugvalues skip non-debug functions.

This patch is by Andrea DiBiagio.


https://reviews.llvm.org/D35637

Files:
  lib/CodeGen/LexicalScopes.cpp
  lib/CodeGen/LiveDebugValues.cpp
  test/CodeGen/X86/debug-nodebug-crash.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35637.107332.patch
Type: text/x-patch
Size: 4781 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170719/65c3d42f/attachment.bin>


More information about the llvm-commits mailing list