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
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(