summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2015-06-24 10:38:27 +0100
committerNicolas Geoffray <ngeoffray@google.com>2015-06-24 16:20:16 +0100
commit574cce14025e153d87ec051926d331c5a39e5f92 (patch)
tree1efbcaf221db15cc86351a4e21634847c746f31f /compiler/optimizing
parent310b0f5f15ac9ef8fb7ed0a12ff9ba3e4da17033 (diff)
downloadart-574cce14025e153d87ec051926d331c5a39e5f92.zip
art-574cce14025e153d87ec051926d331c5a39e5f92.tar.gz
art-574cce14025e153d87ec051926d331c5a39e5f92.tar.bz2
BCE: Narrow instead of unconditionnaly overwrite the range.
bug:21862741 (cherry picked from commit a09ff9c11f07863ac57e6120a824f0d20dfaa284) Change-Id: Ia8e903e09a7f9c2b8ef7cf3522f73f154534b81f
Diffstat (limited to 'compiler/optimizing')
-rw-r--r--compiler/optimizing/bounds_check_elimination.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/optimizing/bounds_check_elimination.cc b/compiler/optimizing/bounds_check_elimination.cc
index 900dabe..92c7e28 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);
}
}