From 57f1e2cee06f9b57995727d786aeb1031c5376bd Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Fri, 25 Feb 2011 01:04:22 +0000 Subject: [PATCH] Try harder to get the hint by preferring to evict hint interference. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126463 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/AllocationOrder.h | 2 ++ lib/CodeGen/RegAllocGreedy.cpp | 3 +++ 2 files changed, 5 insertions(+) diff --git a/lib/CodeGen/AllocationOrder.h b/lib/CodeGen/AllocationOrder.h index 3db4b6925fc..61fd8f881a8 100644 --- a/lib/CodeGen/AllocationOrder.h +++ b/lib/CodeGen/AllocationOrder.h @@ -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 diff --git a/lib/CodeGen/RegAllocGreedy.cpp b/lib/CodeGen/RegAllocGreedy.cpp index 03d1372c2f9..406485aaf49 100644 --- a/lib/CodeGen/RegAllocGreedy.cpp +++ b/lib/CodeGen/RegAllocGreedy.cpp @@ -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) -- 2.34.1