diff options
author | Lang Hames <lhames@gmail.com> | 2009-05-11 23:14:13 +0000 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2009-05-11 23:14:13 +0000 |
commit | f094cbbcb9d72c806ad5fe5f0e886d2dc07fd853 (patch) | |
tree | a597509416e5fd64e43f56dd9d61293b76e2432a | |
parent | a3bb6f2e5bb1f3cebf46cab29a7d17a1db863955 (diff) | |
download | bcm5719-llvm-f094cbbcb9d72c806ad5fe5f0e886d2dc07fd853.tar.gz bcm5719-llvm-f094cbbcb9d72c806ad5fe5f0e886d2dc07fd853.zip |
Fixed PR4090.
llvm-svn: 71495
-rw-r--r-- | llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp b/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp index 9d1297b72c4..a7807f130e4 100644 --- a/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp +++ b/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp @@ -608,14 +608,29 @@ bool SimpleRegisterCoalescing::ReMaterializeTrivialDef(LiveInterval &SrcInt, // If copy kills the source register, find the last use and propagate // kill. + bool checkForDeadDef = false; MachineBasicBlock *MBB = CopyMI->getParent(); if (CopyMI->killsRegister(SrcInt.reg)) - TrimLiveIntervalToLastUse(CopyIdx, MBB, SrcInt, SrcLR); + if (!TrimLiveIntervalToLastUse(CopyIdx, MBB, SrcInt, SrcLR)) { + checkForDeadDef = true; + } MachineBasicBlock::iterator MII = next(MachineBasicBlock::iterator(CopyMI)); CopyMI->removeFromParent(); tii_->reMaterialize(*MBB, MII, DstReg, DefMI); MachineInstr *NewMI = prior(MII); + + if (checkForDeadDef) { + // PR4090 fix: Trim interval failed because there was no use of the + // source interval in this MBB. If the def is in this MBB too then we + // should mark it dead: + if (DefMI->getParent() == MBB) { + DefMI->addRegisterDead(SrcInt.reg, tri_); + SrcLR->end = SrcLR->start + 1; + } + + } + // CopyMI may have implicit operands, transfer them over to the newly // rematerialized instruction. And update implicit def interval valnos. for (unsigned i = CopyMI->getDesc().getNumOperands(), |