[PATCH] D41698: [DebugInfo] Enable debug information for C99 VLA types

Sander de Smalen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 31 04:48:56 PST 2018


sdesmalen added inline comments.


================
Comment at: lib/CodeGen/CGDecl.cpp:990
+          D.getLocation(), D.getLocation(), &NameIdent, QT,
+          getContext().CreateTypeSourceInfo(QT), SC_Auto);
+
----------------
aprantl wrote:
> sdesmalen wrote:
> > aprantl wrote:
> > > I think it does, but can you assert me that this generates the same code with and without -g ?
> > I'm not really sure what you mean with 'generates the same code', because without -g this function is not invoked? However, this function only affects debug information, not anything else related to the actual creation of the VLA. So without -g, no 'dbg.declare()' or corresponding DILocalVariables are generated for each subexpression of each dimension.
> What I meant is that regardless of code being compile with or without -g, the .text section of the resulting binary is identical.
Actually, before I commit this patch, I just realize this is not the case. At least not with -O0 since it creates a stackobject to store the vla-size subexpression, which is referenced by the dbg.declare(). We can assume this store/alloca to be DCE'd at optimization levels higher than O0 so it should not have any impact, but strictly taken the .text section will not be the same with and without -g at -O0.


https://reviews.llvm.org/D41698





More information about the cfe-commits mailing list