summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2011-06-17 13:59:43 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2011-06-17 13:59:43 +0000
commitdb3983bd762a53f197f6c8a6de401974f39f4789 (patch)
treec487e1a87c9960e05666d5e2781ee2cd4c006364 /lib
parent566a4acfef68c00acc34fe9a9b474d3b200f4ecf (diff)
downloadllvm-db3983bd762a53f197f6c8a6de401974f39f4789.tar.gz
llvm-db3983bd762a53f197f6c8a6de401974f39f4789.tar.bz2
llvm-db3983bd762a53f197f6c8a6de401974f39f4789.tar.xz
Two fixes relating to debug value:
* 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
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/TailDuplication.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/CodeGen/TailDuplication.cpp b/lib/CodeGen/TailDuplication.cpp
index 90cb72f3b6..c27e0d4ed6 100644
--- a/lib/CodeGen/TailDuplication.cpp
+++ b/lib/CodeGen/TailDuplication.cpp
@@ -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);
@@ -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;
}