diff options
author | Aditya Nandakumar <aditya_nandakumar@apple.com> | 2013-12-05 21:18:40 +0000 |
---|---|---|
committer | Aditya Nandakumar <aditya_nandakumar@apple.com> | 2013-12-05 21:18:40 +0000 |
commit | 226e3eab9bb39e6b73122c26532cfa8242eb6d4e (patch) | |
tree | c52333378fe1e9ec2ecea9d16075602d051701a3 | |
parent | 32cbcf22958b7f7d214348b0fe5c48bf7b64eada (diff) | |
download | llvm-226e3eab9bb39e6b73122c26532cfa8242eb6d4e.tar.gz llvm-226e3eab9bb39e6b73122c26532cfa8242eb6d4e.tar.bz2 llvm-226e3eab9bb39e6b73122c26532cfa8242eb6d4e.tar.xz |
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
-rw-r--r-- | lib/CodeGen/AllocationOrder.h | 6 | ||||
-rw-r--r-- | lib/CodeGen/RegAllocGreedy.cpp | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/CodeGen/AllocationOrder.h b/lib/CodeGen/AllocationOrder.h index aed461a7ed..64ff2a7ce8 100644 --- a/lib/CodeGen/AllocationOrder.h +++ b/lib/CodeGen/AllocationOrder.h @@ -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; diff --git a/lib/CodeGen/RegAllocGreedy.cpp b/lib/CodeGen/RegAllocGreedy.cpp index 3a02aaec34..7ddc4d5ad8 100644 --- a/lib/CodeGen/RegAllocGreedy.cpp +++ b/lib/CodeGen/RegAllocGreedy.cpp @@ -723,7 +723,7 @@ unsigned RAGreedy::tryEvict(LiveInterval &VirtReg, } 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. |