diff options
author | 2015-06-20 23:49:01 +0100 | |
---|---|---|
committer | 2015-06-20 23:49:01 +0100 | |
commit | 8d82a0c2b2b12f259ccb357d3b1e699c68ad0400 (patch) | |
tree | 01bf7818062d6832a28d13fdeeccf27012bebb92 /compiler/optimizing/bounds_check_elimination.cc | |
parent | 883ac209066d61404627a8820770755d60068a2b (diff) |
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
Change-Id: Idbe50ac114287ea6d852fb6fe9f9e2d440d18af5
Diffstat (limited to 'compiler/optimizing/bounds_check_elimination.cc')
-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( |