[PATCH] D73478: [DebugInfo] replaceDbgUsesWithUndef before removing single store alloca

Orlando Cazalet-Hyams via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 28 01:56:20 PST 2020


Orlando added a comment.

Hi @dblaikie, thanks for your comments.

> At least in this example, while it has an effect on the generated IR, it doesn't seem to have an effect on the resulting object file

Now you mention it I think a couple of these I have lined up should not ever affect the object file, but do, because of this:

Good: `clang -O2 -g -emit-llvm ex.c -o -` adds all DILocalVariables to the DISubprogram retainedNodes list (even when the DILocalVariable still has other uses).
Bad: `clang ex.c -O0 -g -emit-llvm  -Xclang -disable-O0-optnone -o - | opt -O2 -S ` does not on trunk, but does with my changes because the undef-instead-of-dropped dbg.value uses the DILocalVariable metadata.

At a glance it looks like running at >O0 will add all DILocalVariables to a DISubprogram retainedNode list, and running at O0 does not.

Not sure if this is a bug or something I just wasn't aware of. I was compiling all of these test cases with the 'Bad' build line above, so any  dropped dbg.values which were the last users of the DILocalVariable metadata caused the local variable to be omitted from the final dwarf.


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

https://reviews.llvm.org/D73478





More information about the llvm-commits mailing list