This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo] Fix potential CU mismatch for SubprogramScopeDIEs.
ClosedPublic

Authored by JDevlieghere on Nov 13 2017, 2:26 PM.

Details

Summary

In constructAbstractSubprogramScopeDIE there can be a potential mismatch
between this and the CU of ContextDIE when a scope is shared between
two DISubprograms belonging to a different CU. In that case, this is
the CU that was specified in the IR, but the CU of ContextDIE is that of
the first subprogram that was emitted. This patch fixes the mismatch by
looking up the CU of ContextDIE, and switching to use that.

This fixes PR35212 (https://bugs.llvm.org/show_bug.cgi?id=35212)

Patch by Philip Craig!

Diff Detail

Repository
rL LLVM

Event Timeline

JDevlieghere created this revision.Nov 13 2017, 2:26 PM

Thanks so much for helping us with this @JDevlieghere!

dblaikie added inline comments.Nov 13 2017, 3:27 PM
test/DebugInfo/cross-cu-scope.ll
3 ↗(On Diff #122729)

Include the original source code here to make it clear what's being modeled?

Is this reproducible in C or C++, or only in Rust?

aprantl added inline comments.Nov 13 2017, 3:51 PM
test/DebugInfo/cross-cu-scope.ll
2 ↗(On Diff #122729)

Can you add a comment that explains what is being tested here?

  • Add source and description to test case
JDevlieghere marked 2 inline comments as done.
  • Further reduced testcase
  • Use %llc_dwarf
test/DebugInfo/cross-cu-scope.ll
3 ↗(On Diff #122729)

My gut feeling says it might occur with C++ and LTO, but I couldn't come up with the actual code to make it happen.

aprantl accepted this revision.Nov 14 2017, 10:24 AM
aprantl added inline comments.
test/DebugInfo/cross-cu-scope.ll
11 ↗(On Diff #122858)

can you add a check for there name or something that would make it obvious which of the two CUs we expect here?

This revision is now accepted and ready to land.Nov 14 2017, 10:24 AM
This revision was automatically updated to reflect the committed changes.