Try harder to get the hint by preferring to evict hint interference.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Fri, 25 Feb 2011 01:04:22 +0000 (01:04 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Fri, 25 Feb 2011 01:04:22 +0000 (01:04 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126463 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AllocationOrder.h
lib/CodeGen/RegAllocGreedy.cpp

index 3db4b6925fca84fbc244d1efc54af104ab5183c7..61fd8f881a8c735de7f80c7bc2357583e4a7ec13 100644 (file)
@@ -47,6 +47,8 @@ public:
   /// rewind - Start over from the beginning.
   void rewind() { Pos = 0; }
 
+  /// isHint - Return true if PhysReg is a preferred register.
+  bool isHint(unsigned PhysReg) const { return PhysReg == Hint; }
 };
 
 } // end namespace llvm
index 03d1372c2f961220ba6ebb8b41c7afab4fda8c8b..406485aaf496de7a94d18e5a325c7cab37c62255 100644 (file)
@@ -379,6 +379,9 @@ unsigned RAGreedy::tryEvict(LiveInterval &VirtReg,
     // Best so far.
     BestPhys = PhysReg;
     BestWeight = Weight;
+    // Stop if the hint can be used.
+    if (Order.isHint(PhysReg))
+      break;
   }
 
   if (!BestPhys)