[LiveDebugValues] Do not insert DBG_VALUEs after a MBB terminator
authorVedant Kumar <vsk@apple.com>
Tue, 3 Mar 2020 19:08:48 +0000 (11:08 -0800)
committerVedant Kumar <vsk@apple.com>
Tue, 3 Mar 2020 21:00:52 +0000 (13:00 -0800)
commit2bf496620cbb52f918b24bfa4283f5712fb3b937
tree5d4086450c775b858296c705935ad11eb7ccc3c2
parente70a9f3850255cb610fc56a30dec6f52b9d734e9
[LiveDebugValues] Do not insert DBG_VALUEs after a MBB terminator

This fixes a miscompile that happened because a DBG_VALUE interfered
with the MachineOutliner's liveness analysis.

Inserting a DBG_VALUE after a terminator breaks predicates on MBB such
as isReturnBlock(). And the resulting DBG_VALUE cannot be "live".

I plan to introduce a MachineVerifier check for this situation in a
follow up.

rdar://59859175

Testing: check-llvm, LNT build with a stage2 compiler & entry values
enabled

Differential Revision: https://reviews.llvm.org/D75548
llvm/lib/CodeGen/LiveDebugValues.cpp
llvm/test/DebugInfo/MIR/X86/dbginfo-entryvals.mir