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

Kristina Bessonova via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 13 05:33:08 PDT 2023


krisb added a comment.

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()`).


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