summaryrefslogtreecommitdiff
path: root/compiler/optimizing/bounds_check_elimination.cc
diff options
context:
space:
mode:
author Aart Bik <ajcbik@google.com> 2016-10-18 11:35:22 -0700
committer Aart Bik <ajcbik@google.com> 2016-10-19 10:30:35 -0700
commit12a1060d7cf3947b5bf540a9803878985b21587f (patch)
tree14e7f263e4a3bf0f10e11fdfd4a982000fe14786 /compiler/optimizing/bounds_check_elimination.cc
parent63104356aac6511791cf0d7c18b628a558f357e1 (diff)
Fix bug in dynamic BCE. With regression test.
Rationale: We implicitly assumed anything on a fixed offset to a suitable candidate could be picked for codegen. Although this is usually true, the scanner found an exception (on types). So, it is best to make the test explicit. Note: some type implications are TBD. Bug:32193474 Test: test-art-host and offending APKs Change-Id: I664a2caa97a7f231509f8832b940dd72da11a372
Diffstat (limited to 'compiler/optimizing/bounds_check_elimination.cc')
-rw-r--r--compiler/optimizing/bounds_check_elimination.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/optimizing/bounds_check_elimination.cc b/compiler/optimizing/bounds_check_elimination.cc
index 994d394a2a..529fc9e261 100644
--- a/compiler/optimizing/bounds_check_elimination.cc
+++ b/compiler/optimizing/bounds_check_elimination.cc
@@ -1361,6 +1361,11 @@ class BCEVisitor : public HGraphVisitor {
ValueBound other_value = ValueBound::AsValueBound(other_index);
int32_t other_c = other_value.GetConstant();
if (array_length == other_array_length && base == other_value.GetInstruction()) {
+ // Ensure every candidate could be picked for code generation.
+ bool b1 = false, b2 = false;
+ if (!induction_range_.CanGenerateRange(other_bounds_check, other_index, &b1, &b2)) {
+ continue;
+ }
// Does the current basic block dominate all back edges? If not,
// add this candidate later only if it falls into the range.
if (!loop->DominatesAllBackEdges(user->GetBlock())) {