[llvm-commits] [llvm] r42903 - /llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp

Evan Cheng evan.cheng at apple.com
Fri Oct 12 02:15:54 PDT 2007


Author: evancheng
Date: Fri Oct 12 04:15:53 2007
New Revision: 42903

URL: http://llvm.org/viewvc/llvm-project?rev=42903&view=rev
Log:
Restrict EXTRACT_SUBREG coalescing to avoid negative performance impact.

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=42903&r1=42902&r2=42903&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
+++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Fri Oct 12 04:15:53 2007
@@ -264,8 +264,13 @@
         if (li_->hasInterval(*SR) && RHS.overlaps(li_->getInterval(*SR))) {
           DOUT << "Interfere with sub-register ";
           DEBUG(li_->getInterval(*SR).print(DOUT, mri_));
-          return true;
+          return true; // Not coalescable
         }
+    } else if (li_->getInterval(repDstReg).getSize() >
+               li_->getInterval(repSrcReg).getSize()) {
+      // Be conservative. If both sides are virtual registers, do not coalesce
+      // if the sub-register live interval is longer.
+      return false;
     }
   } else if (differingRegisterClasses(repSrcReg, repDstReg)) {
     // If they are not of the same register class, we cannot join them.





More information about the llvm-commits mailing list