More suspend check repair.
The previous fix to the suspend check optimization mechanism left
a bug in the handling of constant-folded branches.
Change-Id: Ib71f1cb9f17203bee26746006e568d448666962d
diff --git a/compiler/dex/mir_graph.h b/compiler/dex/mir_graph.h
index 45e425b..af1ae44 100644
--- a/compiler/dex/mir_graph.h
+++ b/compiler/dex/mir_graph.h
@@ -232,8 +232,7 @@
*/
struct MIR {
DecodedInstruction dalvikInsn;
- uint16_t width;
- bool backwards_branch; // TODO: may be useful to make this an attribute flag word.
+ uint32_t width; // NOTE: only need 16 bits for width.
unsigned int offset;
int m_unit_index; // From which method was this MIR included
MIR* prev;
@@ -560,6 +559,14 @@
return special_case_;
}
+ bool IsBackedge(BasicBlock* branch_bb, BasicBlock* target_bb) {
+ return ((target_bb != NULL) && (target_bb->start_offset <= branch_bb->start_offset));
+ }
+
+ bool IsBackwardsBranch(BasicBlock* branch_bb) {
+ return IsBackedge(branch_bb, branch_bb->taken) || IsBackedge(branch_bb, branch_bb->fall_through);
+ }
+
void BasicBlockCombine();
void CodeLayout();
void DumpCheckStats();