Do not update Out after it has a valid location.
Slow paths use LocationSummary to know where to move
things around, and they are executed at the end of the
code generation.
This fix is needed for https://android-review.googlesource.com/#/c/113345/.
Change-Id: Id336c6409479b1de6dc839b736a7234d08a7774a
diff --git a/compiler/optimizing/code_generator.cc b/compiler/optimizing/code_generator.cc
index c75980d..0dfbad2 100644
--- a/compiler/optimizing/code_generator.cc
+++ b/compiler/optimizing/code_generator.cc
@@ -281,16 +281,22 @@
HInstruction* previous = instruction->GetPrevious();
Location temp_location = GetTemporaryLocation(instruction->AsTemporary());
Move(previous, temp_location, instruction);
- previous->GetLocations()->SetOut(temp_location);
}
return;
}
AllocateRegistersLocally(instruction);
for (size_t i = 0, e = instruction->InputCount(); i < e; ++i) {
Location location = instruction->GetLocations()->InAt(i);
+ HInstruction* input = instruction->InputAt(i);
if (location.IsValid()) {
// Move the input to the desired location.
- Move(instruction->InputAt(i), location, instruction);
+ if (input->GetNext()->IsTemporary()) {
+ // If the input was stored in a temporary, use that temporary to
+ // perform the move.
+ Move(input->GetNext(), location, instruction);
+ } else {
+ Move(input, location, instruction);
+ }
}
}
}