[llvm-branch-commits] [llvm-branch] r81032 - in /llvm/branches/release_26: include/llvm/Target/TargetRegisterInfo.h lib/CodeGen/RegAllocPBQP.cpp lib/CodeGen/VirtRegRewriter.cpp

Tanya Lattner tonic at nondot.org
Fri Sep 4 12:45:24 PDT 2009


Author: tbrethou
Date: Fri Sep  4 14:45:24 2009
New Revision: 81032

URL: http://llvm.org/viewvc/llvm-project?rev=81032&view=rev
Log:
Merge 80872 from mainline.
Fixed a test that ensures the LocalRewriter does not attempt to
avoid reloads by reusing clobbered registers.

This was causing issues in 256.bzip2 when compiled with PIC for
a while (starting at r78217), though the problem has since been masked. 

Modified:
    llvm/branches/release_26/include/llvm/Target/TargetRegisterInfo.h
    llvm/branches/release_26/lib/CodeGen/RegAllocPBQP.cpp
    llvm/branches/release_26/lib/CodeGen/VirtRegRewriter.cpp

Modified: llvm/branches/release_26/include/llvm/Target/TargetRegisterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_26/include/llvm/Target/TargetRegisterInfo.h?rev=81032&r1=81031&r2=81032&view=diff

==============================================================================
--- llvm/branches/release_26/include/llvm/Target/TargetRegisterInfo.h (original)
+++ llvm/branches/release_26/include/llvm/Target/TargetRegisterInfo.h Fri Sep  4 14:45:24 2009
@@ -386,9 +386,16 @@
     return NumRegs;
   }
 
-  /// areAliases - Returns true if the two registers alias each other, false
-  /// otherwise
-  bool areAliases(unsigned regA, unsigned regB) const {
+  /// regsOverlap - Returns true if the two registers are equal or alias each
+  /// other. The registers may be virtual register.
+  bool regsOverlap(unsigned regA, unsigned regB) const {
+    if (regA == regB)
+      return true;
+
+    if (isVirtualRegister(regA) || isVirtualRegister(regB))
+      return false;
+
+    // regA and regB are distinct physical registers. Do they alias?
     size_t index = (regA + regB * 37) & (AliasesHashSize-1);
     unsigned ProbeAmt = 0;
     while (AliasesHash[index*2] != 0 &&
@@ -403,17 +410,6 @@
     return false;
   }
 
-  /// regsOverlap - Returns true if the two registers are equal or alias each
-  /// other. The registers may be virtual register.
-  bool regsOverlap(unsigned regA, unsigned regB) const {
-    if (regA == regB)
-      return true;
-
-    if (isVirtualRegister(regA) || isVirtualRegister(regB))
-      return false;
-    return areAliases(regA, regB);
-  }
-
   /// isSubRegister - Returns true if regB is a sub-register of regA.
   ///
   bool isSubRegister(unsigned regA, unsigned regB) const {

Modified: llvm/branches/release_26/lib/CodeGen/RegAllocPBQP.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_26/lib/CodeGen/RegAllocPBQP.cpp?rev=81032&r1=81031&r2=81032&view=diff

==============================================================================
--- llvm/branches/release_26/lib/CodeGen/RegAllocPBQP.cpp (original)
+++ llvm/branches/release_26/lib/CodeGen/RegAllocPBQP.cpp Fri Sep  4 14:45:24 2009
@@ -269,7 +269,7 @@
       unsigned reg2 = *a2Itr;
 
       // If the row/column regs are identical or alias insert an infinity.
-      if ((reg1 == reg2) || tri->areAliases(reg1, reg2)) {
+      if (tri->regsOverlap(reg1, reg2)) {
         (*m)[ri][ci] = std::numeric_limits<PBQP::PBQPNum>::infinity();
         isZeroMatrix = false;
       }

Modified: llvm/branches/release_26/lib/CodeGen/VirtRegRewriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_26/lib/CodeGen/VirtRegRewriter.cpp?rev=81032&r1=81031&r2=81032&view=diff

==============================================================================
--- llvm/branches/release_26/lib/CodeGen/VirtRegRewriter.cpp (original)
+++ llvm/branches/release_26/lib/CodeGen/VirtRegRewriter.cpp Fri Sep  4 14:45:24 2009
@@ -790,7 +790,7 @@
       // value aliases the new register. If so, codegen the previous reload
       // and use this one.          
       unsigned PRRU = Op.PhysRegReused;
-      if (TRI->areAliases(PRRU, PhysReg)) {
+      if (TRI->regsOverlap(PRRU, PhysReg)) {
         // Okay, we found out that an alias of a reused register
         // was used.  This isn't good because it means we have
         // to undo a previous reuse.





More information about the llvm-branch-commits mailing list