Fix a bug in String.charAt() simplification.
Do not pass method index as a bool flag indicating that the
HBoundsCheck originates from a String.charAt(). This was
working only thanks to the method index unlikely to be 0.
This bug was introduced in
https://android-review.googlesource.com/321573 .
Test: Rely on TreeHugger.
Bug: 30933338
Change-Id: I2a51e478ee145d342af8cd49f9fdec7adffd77ff
diff --git a/compiler/optimizing/instruction_simplifier.cc b/compiler/optimizing/instruction_simplifier.cc
index bd20d28..13c7607 100644
--- a/compiler/optimizing/instruction_simplifier.cc
+++ b/compiler/optimizing/instruction_simplifier.cc
@@ -2276,7 +2276,7 @@
HArrayLength* length = new (allocator) HArrayLength(str, dex_pc, /* is_string_length */ true);
invoke->GetBlock()->InsertInstructionBefore(length, invoke);
HBoundsCheck* bounds_check = new (allocator) HBoundsCheck(
- index, length, dex_pc, invoke->GetDexMethodIndex());
+ index, length, dex_pc, /* is_string_char_at */ true);
invoke->GetBlock()->InsertInstructionBefore(bounds_check, invoke);
HArrayGet* array_get = new (allocator) HArrayGet(str,
bounds_check,