Move InlineWithControlFlow to Smali based.

D8 tends to split return blocks instead of having a Phi + single return.

Instead of updating the checker assertions to match the dexer, this CL
moves the function into smali.

For reference, this is the D8 output:

.method public static InlineWithControlFlow(Z)I
    .registers 5
    .param p0, "cond"    # Z

    const/4 v0, 0x1

    .local v0, "const1":I
    const/4 v1, 0x3

    .local v1, "const3":I
    const/4 v2, 0x5

    .local v2, "const5":I
    if-eqz p0, :cond_a

    invoke-static {v0, v1}, LMain;->returnAdd(II)I

    move-result v3

    return v3

    :cond_a
    invoke-static {v2, v1}, LMain;->returnSub(II)I

    move-result v3

    .local v3, "x":I
    return v3
.end method

Bug: 65168732
Test: art/test.py -j20 --host -b

Change-Id: Ic89ff89ab0b8a2b057c5d6157f7b7c73764a1071
diff --git a/test/441-checker-inliner/smali/Smali.smali b/test/441-checker-inliner/smali/Smali.smali
new file mode 100644
index 0000000..7e42755
--- /dev/null
+++ b/test/441-checker-inliner/smali/Smali.smali
@@ -0,0 +1,97 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+.class public LSmali;
+.super Ljava/lang/Object;
+.source "Smali.java"
+
+##  CHECK-START: int Smali.InlineWithControlFlow(boolean) inliner (before)
+##  CHECK-DAG:     <<Const1:i\d+>> IntConstant 1
+##  CHECK-DAG:     <<Const3:i\d+>> IntConstant 3
+##  CHECK-DAG:     <<Const5:i\d+>> IntConstant 5
+##  CHECK-DAG:     <<Add:i\d+>>    InvokeStaticOrDirect [<<Const1>>,<<Const3>>{{(,[ij]\d+)?}}]
+##  CHECK-DAG:     <<Sub:i\d+>>    InvokeStaticOrDirect [<<Const5>>,<<Const3>>{{(,[ij]\d+)?}}]
+##  CHECK-DAG:     <<Phi:i\d+>>    Phi [<<Add>>,<<Sub>>]
+##  CHECK-DAG:                     Return [<<Phi>>]
+
+##  CHECK-START: int Smali.InlineWithControlFlow(boolean) inliner (after)
+##  CHECK-DAG:     <<Const4:i\d+>> IntConstant 4
+##  CHECK-DAG:     <<Const2:i\d+>> IntConstant 2
+##  CHECK-DAG:     <<Phi:i\d+>>    Phi [<<Const4>>,<<Const2>>]
+##  CHECK-DAG:                     Return [<<Phi>>]
+.method public static InlineWithControlFlow(Z)I
+
+    # int x, const1, const3, const5;
+    # const1 = 1;
+    # const3 = 3;
+    # const5 = 5;
+    # if (cond) {
+    #   x = returnAdd(const1, const3);
+    # } else {
+    #   x = returnSub(const5, const3);
+    # }
+    # return x;
+
+    .registers 5
+    .param p0, "cond"    # Z
+
+    .prologue
+    const/4 v0, 0x1
+
+    .local v0, "const1":I
+    const/4 v1, 0x3
+
+    .local v1, "const3":I
+    const/4 v2, 0x5
+
+    .local v2, "const5":I
+    if-eqz p0, :cond_a
+
+    invoke-static {v0, v1}, LSmali;->returnAdd(II)I
+
+    move-result v3
+
+    .local v3, "x":I
+    :goto_9
+    return v3
+
+    .end local v3    # "x":I
+    :cond_a
+    invoke-static {v2, v1}, LSmali;->returnSub(II)I
+
+    move-result v3
+
+    .restart local v3    # "x":I
+    goto :goto_9
+.end method
+
+.method private static returnAdd(II)I
+    .registers 3
+    .param p0, "a"    # I
+    .param p1, "b"    # I
+
+    add-int v0, p0, p1
+
+    return v0
+.end method
+
+.method private static returnSub(II)I
+    .registers 3
+    .param p0, "a"    # I
+    .param p1, "b"    # I
+
+    sub-int v0, p0, p1
+
+    return v0
+.end method
diff --git a/test/441-checker-inliner/src/Main.java b/test/441-checker-inliner/src/Main.java
index 6d6a4f2..aff4a07 100644
--- a/test/441-checker-inliner/src/Main.java
+++ b/test/441-checker-inliner/src/Main.java
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+import java.lang.reflect.Method;
 
 public class Main {
 
@@ -124,32 +125,14 @@
     return incCounter();
   }
 
-  /// CHECK-START: int Main.InlineWithControlFlow(boolean) inliner (before)
-  /// CHECK-DAG:     <<Const1:i\d+>> IntConstant 1
-  /// CHECK-DAG:     <<Const3:i\d+>> IntConstant 3
-  /// CHECK-DAG:     <<Const5:i\d+>> IntConstant 5
-  /// CHECK-DAG:     <<Add:i\d+>>    InvokeStaticOrDirect [<<Const1>>,<<Const3>>{{(,[ij]\d+)?}}]
-  /// CHECK-DAG:     <<Sub:i\d+>>    InvokeStaticOrDirect [<<Const5>>,<<Const3>>{{(,[ij]\d+)?}}]
-  /// CHECK-DAG:     <<Phi:i\d+>>    Phi [<<Add>>,<<Sub>>]
-  /// CHECK-DAG:                     Return [<<Phi>>]
-
-  /// CHECK-START: int Main.InlineWithControlFlow(boolean) inliner (after)
-  /// CHECK-DAG:     <<Const4:i\d+>> IntConstant 4
-  /// CHECK-DAG:     <<Const2:i\d+>> IntConstant 2
-  /// CHECK-DAG:     <<Phi:i\d+>>    Phi [<<Const4>>,<<Const2>>]
-  /// CHECK-DAG:                     Return [<<Phi>>]
-
   public static int InlineWithControlFlow(boolean cond) {
-    int x, const1, const3, const5;
-    const1 = 1;
-    const3 = 3;
-    const5 = 5;
-    if (cond) {
-      x = returnAdd(const1, const3);
-    } else {
-      x = returnSub(const5, const3);
+    try {
+      Class<?> c = Class.forName("Smali");
+      Method m = c.getMethod("InlineWithControlFlow", boolean.class);
+      return (Integer) m.invoke(null, cond);
+    } catch (Throwable t) {
+      throw new RuntimeException(t);
     }
-    return x;
   }
 
   /// CHECK-START: int Main.returnAbs(int) intrinsics_recognition (before)