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 | 73f3d33dbbf2797d662eb12107b0ed5a8b91267f (patch) | |
| tree | 6e6dcc97dcd97b7267a93f8817c483c79c1675a9 /llvm/lib/CodeGen | |
| parent | 6a8b8b5f0dfee7e8c284330e269d63197aee1ed2 (diff) | |
| download | bcm5719-llvm-73f3d33dbbf2797d662eb12107b0ed5a8b91267f.tar.gz bcm5719-llvm-73f3d33dbbf2797d662eb12107b0ed5a8b91267f.zip | |
Check hint registers for interference only once before evictions
llvm-svn: 196536
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/AllocationOrder.h | 6 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/RegAllocGreedy.cpp | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/AllocationOrder.h b/llvm/lib/CodeGen/AllocationOrder.h index aed461a7ed0..64ff2a7ce83 100644 --- a/llvm/lib/CodeGen/AllocationOrder.h +++ b/llvm/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/llvm/lib/CodeGen/RegAllocGreedy.cpp b/llvm/lib/CodeGen/RegAllocGreedy.cpp index 3a02aaec344..7ddc4d5ad86 100644 --- a/llvm/lib/CodeGen/RegAllocGreedy.cpp +++ b/llvm/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. |

