ART: Adds a regression test for an inliner issue

Regression test for CL Ieddadcd94135930a1f29ad64ad57349a384da07f.

Change-Id: Ibc8fd827a4b8b3d0cddf7f7590a689ec99bf1329
diff --git a/test/475-regression-inliner-ids/expected.txt b/test/475-regression-inliner-ids/expected.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/475-regression-inliner-ids/expected.txt
diff --git a/test/475-regression-inliner-ids/info.txt b/test/475-regression-inliner-ids/info.txt
new file mode 100644
index 0000000..d12d32e
--- /dev/null
+++ b/test/475-regression-inliner-ids/info.txt
@@ -0,0 +1,2 @@
+Tests a regression when inlining a method with constants would lead to duplicate
+instruction IDs in the caller graph.
\ No newline at end of file
diff --git a/test/475-regression-inliner-ids/smali/TestCase.smali b/test/475-regression-inliner-ids/smali/TestCase.smali
new file mode 100644
index 0000000..efbe00f
--- /dev/null
+++ b/test/475-regression-inliner-ids/smali/TestCase.smali
@@ -0,0 +1,76 @@
+# 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.
+
+.class public LTestCase;
+
+.super Ljava/lang/Object;
+
+.method private static flagToString(I)Ljava/lang/String;
+  .registers 2
+
+    # The bug is triggered when inlining a method with few Load/StoreLocals but
+    # many constants. The switch instruction helps with that.
+
+    sparse-switch p0, :sswitch_data_1a
+    const/4 v0, 0x0
+
+    :goto_4
+    return-object v0
+
+  :sswitch_5
+    const-string v0, "DEFAULT"
+    goto :goto_4
+
+  :sswitch_8
+    const-string v0, "FLAG_INCLUDE_NOT_IMPORTANT_VIEWS"
+    goto :goto_4
+
+  :sswitch_b
+    const-string v0, "FLAG_REQUEST_TOUCH_EXPLORATION_MODE"
+    goto :goto_4
+
+  :sswitch_e
+    const-string v0, "FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY"
+    goto :goto_4
+
+  :sswitch_11
+    const-string v0, "FLAG_REPORT_VIEW_IDS"
+    goto :goto_4
+
+  :sswitch_14
+    const-string v0, "FLAG_REQUEST_FILTER_KEY_EVENTS"
+    goto :goto_4
+
+  :sswitch_17
+    const-string v0, "FLAG_RETRIEVE_INTERACTIVE_WINDOWS"
+    goto :goto_4
+
+  :sswitch_data_1a
+  .sparse-switch
+      0x1 -> :sswitch_5
+      0x2 -> :sswitch_8
+      0x4 -> :sswitch_b
+      0x8 -> :sswitch_e
+      0x10 -> :sswitch_11
+      0x20 -> :sswitch_14
+      0x40 -> :sswitch_17
+  .end sparse-switch
+.end method
+
+.method public static testCase(I)Ljava/lang/String;
+  .registers 2
+    invoke-static {v1}, LTestCase;->flagToString(I)Ljava/lang/String;
+    move-result-object v0
+    return-object v0
+.end method
diff --git a/test/475-regression-inliner-ids/src/Main.java b/test/475-regression-inliner-ids/src/Main.java
new file mode 100644
index 0000000..bf22062
--- /dev/null
+++ b/test/475-regression-inliner-ids/src/Main.java
@@ -0,0 +1,33 @@
+/*
+* 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.
+*/
+
+import java.lang.reflect.Method;
+
+public class Main {
+
+  // Workaround for b/18051191.
+  class InnerClass {}
+
+  public static void main(String[] args) throws Exception {
+    Class<?> c = Class.forName("TestCase");
+    Method m = c.getMethod("testCase", int.class);
+    String actual = (String) m.invoke(null, 1);
+    String expected = "DEFAULT";
+    if (!expected.equals(actual)) {
+      throw new Error();
+    }
+  }
+}