[PATCH] D70672: [DebugInfo] Don't sink DBG_VALUEs past other DBG_VALUEs of the same variable location
Jeremy Morse via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 25 08:24:35 PST 2019
jmorse created this revision.
jmorse added reviewers: aprantl, vsk, bjope.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
This patch is part of a fix for PR43855 [0], resolving problems in D58386 <https://reviews.llvm.org/D58386> / rGf5e1b718a6 <https://reviews.llvm.org/rGf5e1b718a675a4449b71423f04d38e1e93045105> (which ended up being backed out).
It turns out DBG_VALUEs would be sunk even if the variables location was re-specified in the block, so for example in:
%0 = someinst
DBG_VALUE %0, !123, !DIExpression()
%1 = anotherinst
DBG_VALUE %1, !123, !DIExpression()
if %0 were to sink, the corresponding DBG_VALUE would sink too, past the next DBG_VALUE, effectively re-ordering assignments.
To fix these things: I've added a SeenDbgVars set recording what variable locations have been seen in a block already (working bottom up), and now flag DBG_VALUEs that would pass a later DBG_VALUE for the same variable.
If such a DBG_VALUE has its operand sunk, then it will now be set to undef, if it can't be copy propagated. I've split out the copy-prop code into a helper function to ease this. This patch is based on a tree with f5e1b718a6 reapplied to make it easier to read.
NB, this only works for repeated DBG_VALUEs in the same basic block, the general case involving control flow is much harder, which I've written up in [1].
[0] https://bugs.llvm.org/show_bug.cgi?id=43855
[1] https://bugs.llvm.org/show_bug.cgi?id=44117
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D70672
Files:
llvm/lib/CodeGen/MachineSink.cpp
llvm/test/DebugInfo/MIR/X86/machinesink.mir
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70672.230907.patch
Type: text/x-patch
Size: 14039 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191125/eb3652c1/attachment.bin>
More information about the llvm-commits
mailing list