Simplify compiler's suspend check mechanism.

Move to a single mechanism for suspend checks.  Previously backwards
branches only checked the suspend count when an internal counter
reached zero, while returns always checked.  Now all checks use
the counter.

Change-Id: Ibca2881e102babbd134bb9b41d798e9e4a3b522c
diff --git a/src/compiler/codegen/arm/MethodCodegenDriver.cc b/src/compiler/codegen/arm/MethodCodegenDriver.cc
index fb665e6..6331254 100644
--- a/src/compiler/codegen/arm/MethodCodegenDriver.cc
+++ b/src/compiler/codegen/arm/MethodCodegenDriver.cc
@@ -1169,17 +1169,17 @@
             break;
 
         case OP_RETURN_VOID:
-            genSuspendPoll(cUnit, mir);
+            genSuspendTest(cUnit, mir);
             break;
 
         case OP_RETURN:
         case OP_RETURN_OBJECT:
-            genSuspendPoll(cUnit, mir);
+            genSuspendTest(cUnit, mir);
             storeValue(cUnit, getRetLoc(cUnit), rlSrc[0]);
             break;
 
         case OP_RETURN_WIDE:
-            genSuspendPoll(cUnit, mir);
+            genSuspendTest(cUnit, mir);
             storeValueWide(cUnit, getRetLocWide(cUnit), rlSrc[0]);
             break;
 
diff --git a/src/compiler/codegen/arm/Thumb2/Gen.cc b/src/compiler/codegen/arm/Thumb2/Gen.cc
index c136660..094d10c 100644
--- a/src/compiler/codegen/arm/Thumb2/Gen.cc
+++ b/src/compiler/codegen/arm/Thumb2/Gen.cc
@@ -1789,28 +1789,6 @@
     oatInsertGrowableList(&cUnit->suspendLaunchpads, (intptr_t)target);
 }
 
-/* Check for pending suspend request.  */
-STATIC void genSuspendPoll(CompilationUnit* cUnit, MIR* mir)
-{
-    if (NO_SUSPEND || mir->optimizationFlags & MIR_IGNORE_SUSPEND_CHECK) {
-        return;
-    }
-    oatFlushAllRegs(cUnit);
-    oatLockCallTemps(cUnit);   // Explicit register usage
-    int rSuspendCount = r1;
-    ArmLIR* ld;
-    ld = loadWordDisp(cUnit, rSELF,
-        art::Thread::SuspendCountOffset().Int32Value(), rSuspendCount);
-    setMemRefType(ld, true /* isLoad */, kMustNotAlias);
-    loadWordDisp(cUnit, rSELF,
-                 OFFSETOF_MEMBER(Thread, pCheckSuspendFromCode), rLR);
-    genRegCopy(cUnit, r0, rSELF);
-    opRegImm(cUnit, kOpCmp, rSuspendCount, 0);
-    genIT(cUnit, kArmCondNe, "");
-    opReg(cUnit, kOpBlx, rLR);
-    oatFreeCallTemps(cUnit);
-}
-
 /*
  * The following are the first-level codegen routines that analyze the format
  * of each bytecode then either dispatch special purpose codegen routines