summaryrefslogtreecommitdiff
path: root/compiler/optimizing
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2016-07-13 18:07:04 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2016-07-13 18:07:04 +0000
commit633c22de95fe6f80c0dd3176e15de4de3ee4bc79 (patch)
tree0f9983cabba29de867051ea990221603f0ff765a /compiler/optimizing
parentbcdc888a393d226a970f4611b649cd9a3de815b9 (diff)
parentf64a6ab5f69446303faadbf6a0ede00af435e25c (diff)
Merge "Improve search for available spill slots in RA"
Diffstat (limited to 'compiler/optimizing')
-rw-r--r--compiler/optimizing/register_allocator.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/compiler/optimizing/register_allocator.cc b/compiler/optimizing/register_allocator.cc
index 9d99668484..1b33408b7e 100644
--- a/compiler/optimizing/register_allocator.cc
+++ b/compiler/optimizing/register_allocator.cc
@@ -1346,9 +1346,15 @@ void RegisterAllocator::AllocateSpillSlotFor(LiveInterval* interval) {
// Find an available spill slot.
size_t slot = 0;
for (size_t e = spill_slots->size(); slot < e; ++slot) {
- if ((*spill_slots)[slot] <= parent->GetStart()
- && (slot == (e - 1) || (*spill_slots)[slot + 1] <= parent->GetStart())) {
- break;
+ if ((*spill_slots)[slot] <= parent->GetStart()) {
+ if (!parent->NeedsTwoSpillSlots()) {
+ // One spill slot is sufficient.
+ break;
+ }
+ if (slot == e - 1 || (*spill_slots)[slot + 1] <= parent->GetStart()) {
+ // Two spill slots are available.
+ break;
+ }
}
}