diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2014-09-11 08:21:10 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-09-11 08:21:10 +0000 |
commit | c7f6b86c269727fe031146b9c18652d40916d46f (patch) | |
tree | bb4891cacd8c5a2deeed633854bd7cb7de5f1c0e /compiler | |
parent | b9620f305c79914f5159cf9279a7ccd173af1186 (diff) | |
parent | 2a877f32fe145ad50250389df958a559e7d4ad92 (diff) | |
download | android_art-c7f6b86c269727fe031146b9c18652d40916d46f.tar.gz android_art-c7f6b86c269727fe031146b9c18652d40916d46f.tar.bz2 android_art-c7f6b86c269727fe031146b9c18652d40916d46f.zip |
Merge "Fix bug in register allocator."
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/optimizing/register_allocator.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/compiler/optimizing/register_allocator.cc b/compiler/optimizing/register_allocator.cc index 54888ba7d8..b451ef4c4b 100644 --- a/compiler/optimizing/register_allocator.cc +++ b/compiler/optimizing/register_allocator.cc @@ -738,9 +738,14 @@ static bool IsInputMove(HInstruction* instruction) { return instruction->GetLifetimePosition() == kInputMoveLifetimePosition; } +static bool IsValidDestination(Location destination) { + return destination.IsRegister() || destination.IsStackSlot() || destination.IsDoubleStackSlot(); +} + void RegisterAllocator::AddInputMoveFor(HInstruction* instruction, Location source, Location destination) const { + DCHECK(IsValidDestination(destination)); if (source.Equals(destination)) return; DCHECK(instruction->AsPhi() == nullptr); @@ -763,6 +768,7 @@ void RegisterAllocator::AddInputMoveFor(HInstruction* instruction, void RegisterAllocator::InsertParallelMoveAt(size_t position, Location source, Location destination) const { + DCHECK(IsValidDestination(destination)); if (source.Equals(destination)) return; HInstruction* at = liveness_.GetInstructionFromPosition(position / 2); @@ -806,6 +812,7 @@ void RegisterAllocator::InsertParallelMoveAt(size_t position, void RegisterAllocator::InsertParallelMoveAtExitOf(HBasicBlock* block, Location source, Location destination) const { + DCHECK(IsValidDestination(destination)); if (source.Equals(destination)) return; DCHECK_EQ(block->GetSuccessors().Size(), 1u); @@ -828,6 +835,7 @@ void RegisterAllocator::InsertParallelMoveAtExitOf(HBasicBlock* block, void RegisterAllocator::InsertParallelMoveAtEntryOf(HBasicBlock* block, Location source, Location destination) const { + DCHECK(IsValidDestination(destination)); if (source.Equals(destination)) return; HInstruction* first = block->GetFirstInstruction(); @@ -845,6 +853,7 @@ void RegisterAllocator::InsertParallelMoveAtEntryOf(HBasicBlock* block, void RegisterAllocator::InsertMoveAfter(HInstruction* instruction, Location source, Location destination) const { + DCHECK(IsValidDestination(destination)); if (source.Equals(destination)) return; if (instruction->AsPhi() != nullptr) { @@ -892,7 +901,7 @@ void RegisterAllocator::ConnectSiblings(LiveInterval* interval) { Location expected_location = locations->InAt(use->GetInputIndex()); if (expected_location.IsUnallocated()) { locations->SetInAt(use->GetInputIndex(), source); - } else { + } else if (!expected_location.IsConstant()) { AddInputMoveFor(use->GetUser(), source, expected_location); } } |