summaryrefslogtreecommitdiff
path: root/compiler/optimizing/register_allocator.cc
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2015-08-20 19:52:26 +0100
committer Nicolas Geoffray <ngeoffray@google.com> 2015-08-21 15:23:16 +0100
commit2e92bc2ba2446525a07f5172d1cd30ab49d26cd6 (patch)
tree18ea6a6719555fee1b9bc4eb8f40f8850dd36714 /compiler/optimizing/register_allocator.cc
parentcbddb90e515c30983094378e316e446b9edca5d6 (diff)
Fix TrySplitNonPairOrUnalignedPairIntervalAt.
We need to both: 1) Look at pair that don't start at an even register. 2) Also remove the other half from the list of actives. Change-Id: Ia99fa9852c67b8633e8d17a258fe302add54b14a
Diffstat (limited to 'compiler/optimizing/register_allocator.cc')
-rw-r--r--compiler/optimizing/register_allocator.cc18
1 files changed, 16 insertions, 2 deletions
diff --git a/compiler/optimizing/register_allocator.cc b/compiler/optimizing/register_allocator.cc
index 9f32a9eaf8..37c8bc5f51 100644
--- a/compiler/optimizing/register_allocator.cc
+++ b/compiler/optimizing/register_allocator.cc
@@ -587,9 +587,17 @@ void RegisterAllocator::LinearScan() {
while (!unhandled_->IsEmpty()) {
// (1) Remove interval with the lowest start position from unhandled.
LiveInterval* current = unhandled_->Pop();
+
+ // Make sure the interval is an expected state.
DCHECK(!current->IsFixed() && !current->HasSpillSlot());
+ // Make sure we are going in the right order.
DCHECK(unhandled_->IsEmpty() || unhandled_->Peek()->GetStart() >= current->GetStart());
+ // Make sure a low interval is always with a high.
DCHECK(!current->IsLowInterval() || unhandled_->Peek()->IsHighInterval());
+ // Make sure a high interval is always with a low.
+ DCHECK(current->IsLowInterval() ||
+ unhandled_->IsEmpty() ||
+ !unhandled_->Peek()->IsHighInterval());
size_t position = current->GetStart();
@@ -916,13 +924,19 @@ bool RegisterAllocator::TrySplitNonPairOrUnalignedPairIntervalAt(size_t position
if (active->IsHighInterval()) continue;
if (first_register_use > next_use[active->GetRegister()]) continue;
- // Split the first interval found.
- if (!active->IsLowInterval() || IsLowOfUnalignedPairInterval(active)) {
+ // Split the first interval found that is either:
+ // 1) A non-pair interval.
+ // 2) A pair interval whose high is not low + 1.
+ // 3) A pair interval whose low is not even.
+ if (!active->IsLowInterval() ||
+ IsLowOfUnalignedPairInterval(active) ||
+ !IsLowRegister(active->GetRegister())) {
LiveInterval* split = Split(active, position);
active_.DeleteAt(i);
if (split != active) {
handled_.Add(active);
}
+ PotentiallyRemoveOtherHalf(active, &active_, i);
AddSorted(unhandled_, split);
return true;
}