[DebugInfo] Attempt to preserve more information during tail duplication
commit98a021fcbfe104f98c7b67c35af4bbbccc3c1b8f
authorStephen Tozer <stephen.tozer@sony.com>
Fri, 3 Dec 2021 13:35:25 +0000 (3 13:35 +0000)
committerStephen Tozer <stephen.tozer@sony.com>
Fri, 3 Dec 2021 15:30:05 +0000 (3 15:30 +0000)
tree29786b57fde1efa50f08e16e328b52e5ed44d595
parentab0c5cea0b1a9a1227fea840184dd7b5983c22a5
[DebugInfo] Attempt to preserve more information during tail duplication

Prior to this patch, tail duplication handled debug info poorly -
specifically, debug instructions would be dropped instead of being set
undef, potentially extending the lifetimes of prior debug values that
should be killed. The pass was also very aggressive with dropping debug
info, dropping debug info even when the SSA value it referred to was
still present. This patch attempts to handle debug info more carefully,
checking to see whether each affected debug value can still be live,
setting it undef if not.

Reviewed By: jmorse

Differential Revision: https://reviews.llvm.org/D106875
llvm/include/llvm/CodeGen/MachineSSAUpdater.h
llvm/lib/CodeGen/MachineSSAUpdater.cpp
llvm/lib/CodeGen/TailDuplicator.cpp
llvm/test/CodeGen/X86/tail-dup-debugvalue.mir