[PATCH] D144005: [DwarfDebug] Move emission of types from beginModule() to endModule() (4/7)

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 13 11:02:37 PDT 2023


dblaikie added a comment.

In D144005#4188836 <https://reviews.llvm.org/D144005#4188836>, @krisb wrote:

> In D144005#4185541 <https://reviews.llvm.org/D144005#4185541>, @dblaikie wrote:
>
>> Change seems OK - but might be nice to know a bit more about why this is helpful for correcting function-local entities?
>
> Strictly speaking, moving emission of non-local types isn't required to get local types worked. This is mostly done for the sake of unification/simplification since we are stopping emitting anything in `DwarfDebug::beginModule()`. There is another motivation point, but it is a bit speculative: we may get IR (as well as debug metadata) changed after `DwarfDebug::beginModule()`, and if this happened, emitted debug info would be out-of-date. I've found such a case only once, and considered it rather a bug (see for details https://reviews.llvm.org/D113653). I'm not aware of any other cases, but it's still possible to change debug metadata after `DwarfDebug::beginModule()`, so it seems much safer to emit DWARF at a time when we do not expect any changes in IR (i.e. `DwarfDebug::endModule()`).

Perhaps this could be done as a separate change, probably after this sequence is in and baked a while, so that it can be backed out/reverted/understood separately from the rest of this sequence? It's already a fairly involved sequence of patches, would be good to ensure it's not labored with other complexity that could reasonably be considered independent.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144005



More information about the llvm-commits mailing list