[llvm-commits] [llvm] r57706 - in /llvm/branches/release_24: lib/CodeGen/SimpleRegisterCoalescing.cpp test/CodeGen/X86/2008-10-13-CoalescerBug.ll

Tanya Lattner tonic at nondot.org
Fri Oct 17 11:02:30 PDT 2008


Author: tbrethou
Date: Fri Oct 17 13:02:30 2008
New Revision: 57706

URL: http://llvm.org/viewvc/llvm-project?rev=57706&view=rev
Log:
Merge from mainline.
Also update sub-register intervals after a trivial computation is rematt'ed
for a copy instruction. PR2775.


Added:
    llvm/branches/release_24/test/CodeGen/X86/2008-10-13-CoalescerBug.ll
      - copied unchanged from r57458, llvm/trunk/test/CodeGen/X86/2008-10-13-CoalescerBug.ll
Modified:
    llvm/branches/release_24/lib/CodeGen/SimpleRegisterCoalescing.cpp

Modified: llvm/branches/release_24/lib/CodeGen/SimpleRegisterCoalescing.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_24/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=57706&r1=57705&r2=57706&view=diff

==============================================================================
--- llvm/branches/release_24/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
+++ llvm/branches/release_24/lib/CodeGen/SimpleRegisterCoalescing.cpp Fri Oct 17 13:02:30 2008
@@ -456,6 +456,16 @@
   unsigned DefIdx = li_->getDefIndex(CopyIdx);
   const LiveRange *DLR= li_->getInterval(DstReg).getLiveRangeContaining(DefIdx);
   DLR->valno->copy = NULL;
+  // Don't forget to update sub-register intervals.
+  if (TargetRegisterInfo::isPhysicalRegister(DstReg)) {
+    for (const unsigned* SR = tri_->getSubRegisters(DstReg); *SR; ++SR) {
+      if (!li_->hasInterval(*SR))
+        continue;
+      DLR = li_->getInterval(*SR).getLiveRangeContaining(DefIdx);
+      if (DLR && DLR->valno->copy == CopyMI)
+        DLR->valno->copy = NULL;
+    }
+  }
 
   MachineBasicBlock::iterator MII = CopyMI;
   MachineBasicBlock *MBB = CopyMI->getParent();





More information about the llvm-commits mailing list