aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/LiveDebugVariables.cpp
diff options
context:
space:
mode:
authorJeremy Morse <jeremy.morse@sony.com>2023-11-16 15:41:52 +0000
committerJeremy Morse <jeremy.morse@sony.com>2023-11-24 13:30:34 +0000
commit84f6e1d71c19bccd13a23a008ed815391e4f6b8e (patch)
tree5ab855d72995541bd2fd4918e89981c5279bf4ed /llvm/lib/CodeGen/LiveDebugVariables.cpp
parente8cd401eaefe8113cae4b4f85ee78600925a9481 (diff)
downloadllvm-84f6e1d71c19bccd13a23a008ed815391e4f6b8e.zip
llvm-84f6e1d71c19bccd13a23a008ed815391e4f6b8e.tar.gz
llvm-84f6e1d71c19bccd13a23a008ed815391e4f6b8e.tar.bz2
[DebugInfo] Clone dbg.values in SimplifyCFG like normal instructions (#72526)
The code in the CloneInstructionsIntoPredec... function modified by this patch has a long history that dates back to 2011, see d715ec82b4ad12c59. There, when folding branches, all dbg.value intrinsics seen when folding would be saved and then re-inserted at the end of whatever was folded. Over the last 12 years this behaviour has been preserved. However, IMO it's bad behaviour. If we have: inst1 dbg.value1 inst2 dbg.value2 And we fold that sequence into a different block, then we would want the instructions and variable assignments to appear in the same order. However because of this old behaviour, the dbg.values are sunk, and we get: inst1 inst2 dbg.value1 dbg.value2 This clustering of dbg.values can make assignments to the same variable invisible, as well as reducing the coverage of other assignments. This patch relaxes the CloneInstructions... function and allows it to clone and update dbg.values in-place, causing them to appear in the original order in the destination block. I've added some extra dbg.values to the updated test: without the changes to the pass, the dbg.values sink into a blob ahead of the select. The RemoveDIs code can't cope with this right now so I've removed the "--try..." flag, restored in a commit to land in a couple of hours. (Metadata changes to make the LLVM-IR parser not drop the debug-info for it being out of date. The RemoveDIs related RUN line has been removed because it was spuriously passing due to the debug-info being dropped).
Diffstat (limited to 'llvm/lib/CodeGen/LiveDebugVariables.cpp')
0 files changed, 0 insertions, 0 deletions