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
diff --git a/compiler/optimizing/bounds_check_elimination.cc b/compiler/optimizing/bounds_check_elimination.cc
index 97b3725..900dabe 100644
--- a/compiler/optimizing/bounds_check_elimination.cc
+++ b/compiler/optimizing/bounds_check_elimination.cc
@@ -1759,7 +1759,9 @@
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(