Reorder computeInlining() and getDowncastTypeIfNeeded()

Change-Id: I612b658750ee7c7b292f6e5d7e790865e405259e
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/Inliner.java b/src/main/java/com/android/tools/r8/ir/optimize/Inliner.java
index f0f1c29..273f7b7 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/Inliner.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/Inliner.java
@@ -994,17 +994,6 @@
             continue;
           }
 
-          DexType downcastTypeOrNull = getDowncastTypeIfNeeded(strategy, invoke, singleTarget);
-          if (downcastTypeOrNull != null) {
-            DexClass downcastClass = appView.definitionFor(downcastTypeOrNull, context);
-            if (downcastClass == null
-                || AccessControl.isClassAccessible(downcastClass, context, appView)
-                    .isPossiblyFalse()) {
-              continue;
-            }
-          }
-
-
           DexEncodedMethod singleTargetMethod = singleTarget.getDefinition();
           WhyAreYouNotInliningReporter whyAreYouNotInliningReporter =
               oracle.isForcedInliningOracle()
@@ -1023,6 +1012,16 @@
             continue;
           }
 
+          DexType downcastTypeOrNull = getDowncastTypeIfNeeded(strategy, invoke, singleTarget);
+          if (downcastTypeOrNull != null) {
+            DexClass downcastClass = appView.definitionFor(downcastTypeOrNull, context);
+            if (downcastClass == null
+                || AccessControl.isClassAccessible(downcastClass, context, appView)
+                    .isPossiblyFalse()) {
+              continue;
+            }
+          }
+
           if (!inlineeStack.isEmpty()
               && !strategy.allowInliningOfInvokeInInlinee(
                   action, inlineeStack.size(), whyAreYouNotInliningReporter)) {