[PATCH] D70350: [DWARF] Allow cross-CU references of subprogram definitions

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 3 10:51:54 PST 2019


vsk added a comment.

In D70350#1766238 <https://reviews.llvm.org/D70350#1766238>, @dblaikie wrote:

> Shooting from the hip/casual opinion/haven't looked at the details - cross-CU inlining should have the same problem/this should be solved in the same way. (in cross-CU inlining, do we create the source CU (if it has no non-inlined functions, etc) even if nothing's inlined from it (then it'd be an empty CU)? Is it made on-demand when an inlining is needed?)


Yes, cross-CU inlining does solve the same problem. To answer your first question, the CU defining an inlined function is constructed lazily. My rough understanding is that:

- In `DwarfDebug::endFunctionImpl(MachineFunction &MF)`, we gather all the inlined function scopes used in `MF`, then lazily create abstract definition subprograms for the inlined callees (lazily creating their CUs if needed, see `DwarfDebug::constructAbstractSubprogramScopeDIE`)
- Once that's done we emit any necessary TAG_inlined_subroutines.

That sounds similar to suggestion (1) I described in my last comment, except that `DwarfDebug` is responsible for lazily creating the callee's CU.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70350/new/

https://reviews.llvm.org/D70350





More information about the llvm-commits mailing list