[llvm-dev] DebugInfo: Global variable expression management

David Blaikie via llvm-dev llvm-dev at lists.llvm.org
Wed Dec 5 15:58:47 PST 2018

Hi Folks,

Looking into some other issues, I came across a couple of oddities with
regard to debug info for global variables (PR39900
<https://bugs.llvm.org/show_bug.cgi?id=39900> and PR39899

But a broader question I was wondering if it was anyone's radar (it's not
something I'll be pushing on myself in the near future, but just wanted to
see if the idea was already out there, etc):

Why are there DIGlobalVariableExpressions that are both attached as !dbg
metadata on llvm::GlobalVariables, and in the globals() list of a
DICompileUnit? I would've thought, ideally, a DIGlobalVariableExpression
would be mutually exclusively in one place or the other - the only ones in
the globals() list of a DICompileUnit would be the constant values, that
have no place elsewhere. When the storage for a global is optimized away,
it'd be possible to find its DICompileUnit from the scope of the
DIGlobalVariable referenced by the DIGlobalVariableExpression given by the
!dbg on said GlobalVariable & attach the constant
DIGlobalVariableExpression there, perhaps?

Is that a thing folks haev already thought of/planned?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181205/3fa078fc/attachment.html>

More information about the llvm-dev mailing list