[PATCH] D94976: [DWARF] Create subprogram's DIE in the unit specified by its DISubprogram

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 21 07:36:19 PST 2021


jmorse added a comment.

Responding to inline comment that's now sort-of-orphaned: calling back out to constructSubprogramDefinitionDIE sounds good, I've added that to DwarfUnit::getOrCreateContextDIE with a comment.

IMHO, getOrCreateContextDIE is a large part of the problem here, callers use it to create DIEs without actually caring what kind of DIE it is, and so they're not able to make decisions about what CU the DIE should be created in. In the call stack [0] where the fault occurs, it's the earliest point that we can identify we're going to create a Subprogram, and so might need to change unit.

(The skeleton faff was because the DebugInfo/X86/fission-inline.ll test failed otherwise, looks like constructSubprogramDefinitionDIE takes care of that now).

[0] https://gist.github.com/jmorse/bb283cd69b351a8ad568f26a50c5553c



================
Comment at: llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp:863
       if (auto *SP = dyn_cast<DISubprogram>(Element))
-        getOrCreateSubprogramDIE(SP);
+        getOrCreateContextDIE(SP);
       else if (auto *DDTy = dyn_cast<DIDerivedType>(Element)) {
----------------
Changed this to call getOrCreateContextDIE so that it'll switch on whether the SP is a definition or a declaration.


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

https://reviews.llvm.org/D94976



More information about the llvm-commits mailing list