diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2015-06-20 23:49:01 +0100 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2015-06-22 10:09:07 +0100 |
commit | 7d4cc8c786ff4a19234c1b034eae61ac0f3a37da (patch) | |
tree | 2c78a3c37951b0cf663d5c9c22d2fd665a930c55 /compiler/optimizing | |
parent | ff82263e2b96ad099c56c19b91c2286baaf82fa7 (diff) | |
download | art-7d4cc8c786ff4a19234c1b034eae61ac0f3a37da.tar.gz art-7d4cc8c786ff4a19234c1b034eae61ac0f3a37da.tar.bz2 art-7d4cc8c786ff4a19234c1b034eae61ac0f3a37da.zip |
Fix wrong DCHECK in bounds check elimination.
The lower range of an array length instruction can
be changed by other instructions than HBoundsCheck,
like HNewArray.
bug:21862741
(cherry picked from commit 8d82a0c2b2b12f259ccb357d3b1e699c68ad0400)
Change-Id: I1bb1a4f4c6673509dd3fb5184c32992bed876250
Diffstat (limited to 'compiler/optimizing')
-rw-r--r-- | compiler/optimizing/bounds_check_elimination.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/optimizing/bounds_check_elimination.cc b/compiler/optimizing/bounds_check_elimination.cc index 97b3725da1..900dabea0e 100644 --- a/compiler/optimizing/bounds_check_elimination.cc +++ b/compiler/optimizing/bounds_check_elimination.cc @@ -1759,7 +1759,9 @@ class BCEVisitor : public HGraphVisitor { ValueBound lower_bound = range->GetLower(); DCHECK(lower_bound.IsConstant()); DCHECK(const_instr->GetValue() <= kMaxConstantForAddingDeoptimize); - DCHECK_EQ(lower_bound.GetConstant(), const_instr->GetValue() + 1); + // Note that the lower bound of the array length may have been refined + // through other instructions (such as `HNewArray(length - 4)`). + DCHECK_LE(const_instr->GetValue() + 1, lower_bound.GetConstant()); // If array_length is less than lower_const, deoptimize. HBoundsCheck* bounds_check = first_constant_index_bounds_check_map_.Get( |