summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Hello/Hello.cpp
diff options
context:
space:
mode:
authorJeremy Morse <jeremy.morse.llvm@gmail.com>2019-06-27 10:20:27 +0000
committerJeremy Morse <jeremy.morse.llvm@gmail.com>2019-06-27 10:20:27 +0000
commitd528bcd9657312f6317d304fa486f42b034b735c (patch)
treeb6935d2b7f99417b8b3590e560a992a705ced781 /llvm/lib/Transforms/Hello/Hello.cpp
parent74a50a723bfd892b2b8f58967417ea1f3d5ad55c (diff)
downloadbcm5719-llvm-d528bcd9657312f6317d304fa486f42b034b735c.tar.gz
bcm5719-llvm-d528bcd9657312f6317d304fa486f42b034b735c.zip
[DebugInfo] Avoid register coalesing unsoundly changing DBG_VALUE locations
Once MIR code leaves SSA form and the liveness of a vreg is considered, DBG_VALUE insts are able to refer to non-live vregs, because their debug-uses do not contribute to liveness. This non-liveness becomes problematic for optimizations like register coalescing, as they can't ``see'' the debug uses in the liveness analyses. As a result registers get coalesced regardless of debug uses, and that can lead to invalid variable locations containing unexpected values. In the added test case, the first vreg operand of ADD32rr is merged with various copies of the vreg (great for performance), but a DBG_VALUE of the unmodified operand is blindly updated to the modified operand. This changes what value the variable will appear to have in a debugger. Fix this by changing any DBG_VALUE whose operand will be resurrected by register coalescing to be a $noreg DBG_VALUE, i.e. give the variable no location. This is an overapproximation as some coalesced locations are safe (others are not) -- an extra domination analysis would be required to work out which, and it would be better if we just don't generate non-live DBG_VALUEs. This fixes PR40010. Differential Revision: https://reviews.llvm.org/D56151 llvm-svn: 364515
Diffstat (limited to 'llvm/lib/Transforms/Hello/Hello.cpp')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud