diff options
author | 2015-06-24 10:38:27 +0100 | |
---|---|---|
committer | 2015-06-24 15:07:50 +0100 | |
commit | a09ff9c11f07863ac57e6120a824f0d20dfaa284 (patch) | |
tree | d2ddb2da513544e2f64fba6c0e20dbdefe8cc8b2 /compiler/optimizing/bounds_check_elimination.cc | |
parent | 582195dfcee32586b71b0ed00a973cfc7d7b8b57 (diff) |
BCE: Narrow instead of unconditionnaly overwrite the range.
bug:21862741
Change-Id: Ic1c2d6fa64255623f87af33a297c459cc9080d3c
Diffstat (limited to 'compiler/optimizing/bounds_check_elimination.cc')
-rw-r--r-- | compiler/optimizing/bounds_check_elimination.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/optimizing/bounds_check_elimination.cc b/compiler/optimizing/bounds_check_elimination.cc index 900dabea0e..92c7e28e97 100644 --- a/compiler/optimizing/bounds_check_elimination.cc +++ b/compiler/optimizing/bounds_check_elimination.cc @@ -1180,9 +1180,7 @@ class BCEVisitor : public HGraphVisitor { } } ValueRange* narrowed_range = existing_range->Narrow(range); - if (narrowed_range != nullptr) { - GetValueRangeMap(successor)->Overwrite(instruction->GetId(), narrowed_range); - } + GetValueRangeMap(successor)->Overwrite(instruction->GetId(), narrowed_range); } // Special case that we may simultaneously narrow two MonotonicValueRange's to @@ -1730,6 +1728,10 @@ class BCEVisitor : public HGraphVisitor { ValueBound upper = ValueBound(new_array, -right_const); ValueRange* range = new (GetGraph()->GetArena()) ValueRange(GetGraph()->GetArena(), lower, upper); + ValueRange* existing_range = LookupValueRange(left, new_array->GetBlock()); + if (existing_range != nullptr) { + range = existing_range->Narrow(range); + } GetValueRangeMap(new_array->GetBlock())->Overwrite(left->GetId(), range); } } |