[llvm-dev] RFC: DI: Stop preserving types from dead functions

Duncan P. N. Exon Smith via llvm-dev llvm-dev at lists.llvm.org
Tue Sep 1 15:59:54 PDT 2015


Way back in r107027, we started preserving type information of local
variables of functions that are optimized away.  This seemed strange to
me so I dug into the history: apparently, this is so that ctfconvert can
find these types (so they can be exposed in dtrace).

E.g., this commit made it so that for this C code:

    static void foo(void) { struct X { int b; } v; }

we always get the type information for foo.v, even if foo() is optimized
away.

I came across this when trying to reverse the direction of the IR's
DICompileUnit/DISubprogram links.  r107027 effectively forces us to
hold onto subprogram definitions that describe deleted functions.  This
seems quite weird to me :/.

I'm talking to people internally and hoping to find that we just don't
care anymore.  Even if we do, perhaps shoving these types into
'retainedTypes:' in `DICompileUnit` (only if -gkeep-all-types or some
such) will solve the problem for the ctfconvert use case (without
burdening others).

While I sort that out... does anyone else rely on this?  How?  Why?

(The attach patch effectively reverts r107027.)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-DI-Stop-preserving-types-from-dead-functions.patch
Type: application/octet-stream
Size: 7655 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150901/51836b39/attachment.obj>


More information about the llvm-dev mailing list