Fix case where block has no predecessor for StringChange.
Removes part that checks for throwing half of instruction. It's no
longer necessary. Also adds regression test.
Bug: 21902684
(cherry-picked from commit 3e91a44bc9063f7f69b5415e3cf162991f73283f)
Change-Id: I8d7308ff227816fb475341c2b74ed84d5695a2f5
diff --git a/compiler/dex/mir_optimization.cc b/compiler/dex/mir_optimization.cc
index 727d0fd..5bb0ce3 100644
--- a/compiler/dex/mir_optimization.cc
+++ b/compiler/dex/mir_optimization.cc
@@ -1667,15 +1667,9 @@
if (opcode == Instruction::NEW_INSTANCE) {
uint32_t type_idx = mir->dalvikInsn.vB;
if (cu_->compiler_driver->IsStringTypeIndex(type_idx, cu_->dex_file)) {
- // Change NEW_INSTANCE and throwing half of the insn (if it exists) into CONST_4 of 0
+ // Change NEW_INSTANCE into CONST_4 of 0
mir->dalvikInsn.opcode = Instruction::CONST_4;
mir->dalvikInsn.vB = 0;
- MIR* check_mir = GetBasicBlock(bb->predecessors[0])->last_mir_insn;
- if (check_mir != nullptr &&
- static_cast<int>(check_mir->dalvikInsn.opcode) == kMirOpCheck) {
- check_mir->dalvikInsn.opcode = static_cast<Instruction::Code>(kMirOpNop);
- check_mir->dalvikInsn.vB = 0;
- }
}
} else if ((opcode == Instruction::INVOKE_DIRECT) ||
(opcode == Instruction::INVOKE_DIRECT_RANGE)) {