asavonic added a comment.

Thanks a lot for the patch! It would be great to get this issue finally fixed. 
I assume that this is the main patch, other patches in the stack seem like just 
preparation/adjustments needed for this one to work.

> This an alternative implementation for D113741 
> <https://reviews.llvm.org/D113741> which relies on localDecls field of 
> DISubprogram or DILexicalBlock for getting local declarations (types, imports 
> or static variable) for a particular local scope.

Can you include a short description of the issue? PR19238 has a good and short 
example, we can inline it here.

> Another thing that should be noted that with this patch we will no longer 
> emit local declarations if its parent scope doesn't have a LexicalScope 
> calculated for it

If a local declaration (a type or a static variable) is optimized away, then 
with this patch we have no debug information for it, right? For types we have 
`-debug-info-kind=unused-types` as a workaround (as shown in 
lexical-block-retained-types.ll), so the issue is only with static variables 
that have no uses. Given that they were broken before this patch and there is 
no way to access them from a debugger (cannot set a breakpoint if a block is 
optimized away), I think it is fine.



================
Comment at: llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:1382
+      assert((!GV->getScope() || !isa<DILocalScope>(GV->getScope())) &&
+             "Unexpected function-local declaration!");
       if (Processed.insert(GV).second)
----------------
So here we discard LLVM IR metadata that have local declarations tied to a CU, 
right? This will break compatibility with old LLVM IR. Can we do some upgrade 
to convert this "old style" metadata the way we expect it now? Does it make 
sense to support both variants?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125693

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to