AdvanceMIR does not know how to passthrough the empty block
AdvanceMIR utility function could easily traverse the empty
blocks to find the next bytecode.
Change-Id: I037710b567275799f940b5b9766bcafec570b70e
Signed-off-by: Serguei Katkov <serguei.i.katkov@intel.com>
diff --git a/compiler/dex/mir_optimization.cc b/compiler/dex/mir_optimization.cc
index 05414b3..8718191 100644
--- a/compiler/dex/mir_optimization.cc
+++ b/compiler/dex/mir_optimization.cc
@@ -116,13 +116,14 @@
BasicBlock* bb = *p_bb;
if (mir != NULL) {
mir = mir->next;
- if (mir == NULL) {
+ while (mir == NULL) {
bb = GetBasicBlock(bb->fall_through);
if ((bb == NULL) || Predecessors(bb) != 1) {
- mir = NULL;
+ // mir is null and we cannot proceed further.
+ break;
} else {
- *p_bb = bb;
- mir = bb->first_mir_insn;
+ *p_bb = bb;
+ mir = bb->first_mir_insn;
}
}
}