Skip to content

Commit

Permalink
Two fixes relating to debug value:
Browse files Browse the repository at this point in the history
* We should change the generated code because of a debug use.
* Avoid creating debug uses of undef, as they become a kill.
Test to follow.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133255 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
espindola committed Jun 17, 2011
1 parent 566a4ac commit db3983b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/CodeGen/TailDuplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,14 @@ bool TailDuplicatePass::TailDuplicateBlocks(MachineFunction &MF) {
MachineOperand &UseMO = UI.getOperand();
MachineInstr *UseMI = &*UI;
++UI;
if (UseMI->isDebugValue()) {
// SSAUpdate can replace the use with an undef. That creates
// a debug instruction that is a kill.
// FIXME: Should it SSAUpdate job to delete debug instructions
// instead of replacing the use with undef?
UseMI->eraseFromParent();
continue;
}
if (UseMI->getParent() == DefBB && !UseMI->isPHI())
continue;
SSAUpdate.RewriteUse(UseMO);
Expand Down Expand Up @@ -283,6 +291,8 @@ static bool isDefLiveOut(unsigned Reg, MachineBasicBlock *BB,
for (MachineRegisterInfo::use_iterator UI = MRI->use_begin(Reg),
UE = MRI->use_end(); UI != UE; ++UI) {
MachineInstr *UseMI = &*UI;
if (UseMI->isDebugValue())
continue;
if (UseMI->getParent() != BB)
return true;
}
Expand Down

0 comments on commit db3983b

Please sign in to comment.