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_optimization.cc b/compiler/dex/mir_optimization.cc
index 82ba6e3..9f694de 100644
--- a/compiler/dex/mir_optimization.cc
+++ b/compiler/dex/mir_optimization.cc
@@ -311,7 +311,8 @@
case Instruction::IF_GTZ:
case Instruction::IF_LEZ:
// If we've got a backwards branch to return, no need to suspend check.
- if ((bb->taken->dominates_return) && (mir->backwards_branch)) {
+ if ((IsBackedge(bb, bb->taken) && bb->taken->dominates_return) ||
+ (IsBackedge(bb, bb->fall_through) && bb->fall_through->dominates_return)) {
mir->optimization_flags |= MIR_IGNORE_SUSPEND_CHECK;
if (cu_->verbose) {
LOG(INFO) << "Suppressed suspend check on branch to return at 0x" << std::hex << mir->offset;