summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Matthew Gharrity <gharrma@google.com> 2016-07-11 14:45:01 -0700
committer Matthew Gharrity <gharrma@google.com> 2016-07-12 10:20:55 -0700
commitf64a6ab5f69446303faadbf6a0ede00af435e25c (patch)
treea445bbe8fa31ad699b91eee3386e0ac2864f561a
parentdedde3f10d7801ad862d1ca1de89135decff6a60 (diff)
Improve search for available spill slots in RA
Previously we always searched for two adjacent spill slots, even if we only needed one. This small change fixes that. Test: m test-art-host Change-Id: I021d355e6602ffee687c8537a959232b1504dcf1
-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;
+ }
}
}