Add a check in the location summary.
Having SameAsFirstInput for out, and first input Any does not
make sense currently. If it's stack, we are going to overwrite
it, potentially clobbering another local. And constant does not
make sense.
Change-Id: I0ce357137487ed3dcecf4efd9922a039a2a1a29d
diff --git a/compiler/optimizing/locations.h b/compiler/optimizing/locations.h
index de876be..b36e574 100644
--- a/compiler/optimizing/locations.h
+++ b/compiler/optimizing/locations.h
@@ -486,11 +486,17 @@
void SetOut(Location location, Location::OutputOverlap overlaps = Location::kOutputOverlap) {
DCHECK(output_.IsInvalid());
+ if (kIsDebugBuild && location.IsUnallocated()) {
+ if ((location.GetPolicy() == Location::kSameAsFirstInput) && InAt(0).IsUnallocated()) {
+ DCHECK_NE(InAt(0).GetPolicy(), Location::kAny);
+ }
+ }
output_overlaps_ = overlaps;
output_ = location;
}
void UpdateOut(Location location) {
+ DCHECK(!location.IsUnallocated());
// There are two reasons for updating an output:
// 1) Parameters, where we only know the exact stack slot after
// doing full register allocation.