[llvm-branch-commits] [llvm-branch] r71515 - /llvm/branches/Apple/Dib/lib/CodeGen/SimpleRegisterCoalescing.cpp

Bill Wendling isanbard at gmail.com
Mon May 11 16:45:29 PDT 2009


Author: void
Date: Mon May 11 18:45:29 2009
New Revision: 71515

URL: http://llvm.org/viewvc/llvm-project?rev=71515&view=rev
Log:
--- Merging r71495 into '.':
U    lib/CodeGen/SimpleRegisterCoalescing.cpp


Modified:
    llvm/branches/Apple/Dib/lib/CodeGen/SimpleRegisterCoalescing.cpp

Modified: llvm/branches/Apple/Dib/lib/CodeGen/SimpleRegisterCoalescing.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=71515&r1=71514&r2=71515&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
+++ llvm/branches/Apple/Dib/lib/CodeGen/SimpleRegisterCoalescing.cpp Mon May 11 18:45:29 2009
@@ -608,14 +608,29 @@
 
   // 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(),





More information about the llvm-branch-commits mailing list