[PATCH] D60713: [IR] Add DISuprogram and DIE for func decl of an external

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 30 09:01:46 PDT 2019


dexonsmith added a comment.

In D60713#1523315 <https://reviews.llvm.org/D60713#1523315>, @aprantl wrote:

> Prior to this patch Function declarations may not have a !dbg attachment, because there was no use-case for it. With call site debug info, I think it would make sense to revisit this rule. When I made my previous comment, I thought that the updated rule could be:
>
> (1) function definitions may have a distinct DISubprogram attached (as before)
>  (2) function declarations may have a unique DISubprogram attached (new)
>
> If I read the code in Verifier.cpp correctly, then it is legal for a unique DISubprogram to not have a unit, which would cause the declaration-DISubprograms to be uniqued during LTO.
>
> so the (2) should probably be:
>
> (2) function declarations may have a unique DISubprogram attached and it may not have a unit: field
>
> I've CC'ed Duncan in case he can catch a logic error with this reasoning.


That rule seems reasonable.  The critical piece is that declarations will show up in ~every TU, and to be uniqued properly they can't point at anything identifying which TU they're coming from.


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

https://reviews.llvm.org/D60713





More information about the llvm-commits mailing list