[MachineRegisterInfo] Avoid having dbg.values affect code generation

Summary:
Use use_nodbg_empty() rather than use_empty() in
MachineRegisterInfo::EmitLiveInCopies() when determining if a livein
register has any uses or not. Otherwise a single dbg.value can make us
generate different code, meaning -g would affect code generation.

Found when compiling code for my out-of-tree target. Unfortunately I
haven't been able to reproduce the problem on X86 or any of the other
in-tree targets that I tried, so no test case.

Reviewers: MatzeB

Reviewed By: MatzeB

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D39044

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318382 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Mikael Holmen 2017-11-16 07:01:23 +00:00
parent 63a8861896
commit 920531cc2b

View File

@ -428,8 +428,8 @@ MachineRegisterInfo::EmitLiveInCopies(MachineBasicBlock *EntryMBB,
// Emit the copies into the top of the block.
for (unsigned i = 0, e = LiveIns.size(); i != e; ++i)
if (LiveIns[i].second) {
if (use_empty(LiveIns[i].second)) {
// The livein has no uses. Drop it.
if (use_nodbg_empty(LiveIns[i].second)) {
// The livein has no non-dbg uses. Drop it.
//
// It would be preferable to have isel avoid creating live-in
// records for unused arguments in the first place, but it's