Author: evancheng
Date: Tue Aug 14 18:19:28 2007
New Revision: 41084

URL: http://llvm.org/viewvc/llvm-project?rev=41084&view=rev
Log:
Fix for PR1596: AdjustCopiesBackFrom() should conservatively check if any of 
its sub-registers may overlap with the interval of the copy that's being 
coalesced.

Modified:
    llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp

Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=41084&r1=41083&r2=41084&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
+++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Tue Aug 14 18:19:28 2007
@@ -125,6 +125,19 @@
   // live-range starts.  If there are no intervening live ranges between them 
in
   // IntB, we can merge them.
   if (ValLR+1 != BLR) return false;
+
+  // If a live interval is a physical register, conservatively check if any
+  // of its sub-registers is overlapping the live interval of the virtual
+  // register. If so, do not coalesce.
+  if (MRegisterInfo::isPhysicalRegister(IntB.reg) &&
+      *mri_->getSubRegisters(IntB.reg)) {
+    for (const unsigned* SR = mri_->getSubRegisters(IntB.reg); *SR; ++SR)
+      if (li_->hasInterval(*SR) && IntA.overlaps(li_->getInterval(*SR))) {
+        DOUT << "Interfere with sub-register ";
+        DEBUG(li_->getInterval(*SR).print(DOUT, mri_));
+        return false;
+      }
+  }
   
   DOUT << "\nExtending: "; IntB.print(DOUT, mri_);
   


_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to