ART: Remove DCHECKs for boolean type

Since bool and int are interchangeable types, checking whether an
input is kPrimBoolean can fail when replaced with 0/1 constant or
a phi. This patch removes the problematic DCHECKs, adds a best-effort
verification into SSAChecker but leaves the phi case empty until a
suitable analysis is implemented.

Change-Id: I31e8daf27dd33d2fd74049b82bed1cb7c240c8c6
diff --git a/test/474-checker-boolean-input/src/Main.java b/test/474-checker-boolean-input/src/Main.java
new file mode 100644
index 0000000..91e8d4f
--- /dev/null
+++ b/test/474-checker-boolean-input/src/Main.java
@@ -0,0 +1,75 @@
+/*
+* Copyright (C) 2015 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.
+*/
+
+public class Main {
+
+  public static void assertBoolEquals(boolean expected, boolean result) {
+    if (expected != result) {
+      throw new Error("Expected: " + expected + ", found: " + result);
+    }
+  }
+
+  /*
+   * Test that zero/one constants are accepted as boolean inputs.
+   */
+
+  // CHECK-START: boolean Main.TestIntAsBoolean() inliner (before)
+  // CHECK-DAG:     [[Invoke:z\d+]]  InvokeStaticOrDirect
+  // CHECK-DAG:                      BooleanNot [ [[Invoke]] ]
+
+  // CHECK-START: boolean Main.TestIntAsBoolean() inliner (after)
+  // CHECK-DAG:     [[Const:i\d+]]   IntConstant 1
+  // CHECK-DAG:                      BooleanNot [ [[Const]] ]
+
+  public static boolean InlineConst() {
+    return true;
+  }
+
+  public static boolean TestIntAsBoolean() {
+    return InlineConst() != true ? true : false;
+  }
+
+  /*
+   * Test that integer Phis are accepted as boolean inputs until we implement
+   * a suitable type analysis.
+   */
+
+  // CHECK-START: boolean Main.TestPhiAsBoolean(int) inliner (before)
+  // CHECK-DAG:     [[Invoke:z\d+]]  InvokeStaticOrDirect
+  // CHECK-DAG:                      BooleanNot [ [[Invoke]] ]
+
+  // CHECK-START: boolean Main.TestPhiAsBoolean(int) inliner (after)
+  // CHECK-DAG:     [[Phi:i\d+]]     Phi
+  // CHECK-DAG:                      BooleanNot [ [[Phi]] ]
+
+  public static boolean f1;
+  public static boolean f2;
+
+  public static boolean InlinePhi(int x) {
+    return (x == 42) ? f1 : f2;
+  }
+
+  public static boolean TestPhiAsBoolean(int x) {
+    return InlinePhi(x) != true ? true : false;
+  }
+
+  public static void main(String[] args) {
+    f1 = true;
+    f2 = false;
+    assertBoolEquals(true, TestPhiAsBoolean(0));
+    assertBoolEquals(false, TestPhiAsBoolean(42));
+  }
+}