[llvm] r196536 - Check hint registers for interference only once before evictions
Aditya Nandakumar
aditya_nandakumar at apple.com
Thu Dec 5 13:18:40 PST 2013
Author: aditya_nandakumar
Date: Thu Dec 5 15:18:40 2013
New Revision: 196536
URL: http://llvm.org/viewvc/llvm-project?rev=196536&view=rev
Log:
Check hint registers for interference only once before evictions
Modified:
llvm/trunk/lib/CodeGen/AllocationOrder.h
llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp
Modified: llvm/trunk/lib/CodeGen/AllocationOrder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AllocationOrder.h?rev=196536&r1=196535&r2=196536&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AllocationOrder.h (original)
+++ llvm/trunk/lib/CodeGen/AllocationOrder.h Thu Dec 5 15:18:40 2013
@@ -45,10 +45,12 @@ public:
/// Return the next physical register in the allocation order, or 0.
/// It is safe to call next() again after it returned 0, it will keep
/// returning 0 until rewind() is called.
- unsigned next() {
+ unsigned next(unsigned Limit = 0) {
if (Pos < 0)
return Hints.end()[Pos++];
- while (Pos < int(Order.size())) {
+ if (!Limit)
+ Limit = Order.size();
+ while (Pos < int(Limit)) {
unsigned Reg = Order[Pos++];
if (!isHint(Reg))
return Reg;
Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp?rev=196536&r1=196535&r2=196536&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Thu Dec 5 15:18:40 2013
@@ -723,7 +723,7 @@ unsigned RAGreedy::tryEvict(LiveInterval
}
Order.rewind();
- while (unsigned PhysReg = Order.nextWithDups(OrderLimit)) {
+ while (unsigned PhysReg = Order.next(OrderLimit)) {
if (TRI->getCostPerUse(PhysReg) >= CostPerUseLimit)
continue;
// The first use of a callee-saved register in a function has cost 1.
More information about the llvm-commits
mailing list