Check hint registers for interference only once before evictions

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196536 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Aditya Nandakumar 2013-12-05 21:18:40 +00:00
parent 32cbcf2295
commit 226e3eab9b
2 changed files with 5 additions and 3 deletions

View File

@ -45,10 +45,12 @@ public:
/// Return the next physical register in the allocation order, or 0. /// 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 /// It is safe to call next() again after it returned 0, it will keep
/// returning 0 until rewind() is called. /// returning 0 until rewind() is called.
unsigned next() { unsigned next(unsigned Limit = 0) {
if (Pos < 0) if (Pos < 0)
return Hints.end()[Pos++]; return Hints.end()[Pos++];
while (Pos < int(Order.size())) { if (!Limit)
Limit = Order.size();
while (Pos < int(Limit)) {
unsigned Reg = Order[Pos++]; unsigned Reg = Order[Pos++];
if (!isHint(Reg)) if (!isHint(Reg))
return Reg; return Reg;

View File

@ -723,7 +723,7 @@ unsigned RAGreedy::tryEvict(LiveInterval &VirtReg,
} }
Order.rewind(); Order.rewind();
while (unsigned PhysReg = Order.nextWithDups(OrderLimit)) { while (unsigned PhysReg = Order.next(OrderLimit)) {
if (TRI->getCostPerUse(PhysReg) >= CostPerUseLimit) if (TRI->getCostPerUse(PhysReg) >= CostPerUseLimit)
continue; continue;
// The first use of a callee-saved register in a function has cost 1. // The first use of a callee-saved register in a function has cost 1.