This is an archive of the discontinued LLVM Phabricator instance.

Fixing an issue with mixing functions from debug and non-debug CUs
ClosedPublic

Authored by wolfgangp on Jul 19 2017, 11:22 AM.

Details

Summary

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.

Diff Detail

Repository
rL LLVM

Event Timeline

wolfgangp created this revision.Jul 19 2017, 11:22 AM
aprantl accepted this revision.Jul 19 2017, 11:54 AM

Thanks! Looks reasonable.

This revision is now accepted and ready to land.Jul 19 2017, 11:54 AM
This revision was automatically updated to reflect the committed changes.