summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2015-06-18 15:46:47 +0100
committerNicolas Geoffray <ngeoffray@google.com>2015-06-22 11:45:32 +0100
commita04e7b7ceae01a7ceda41419e4c639a43e18361e (patch)
treeceafb0dceeb17948ee39c0280fa2460eec3e1ec5 /test
parent096f357c5dda663c6fbb58bd0154c091aec51f63 (diff)
downloadart-a04e7b7ceae01a7ceda41419e4c639a43e18361e.zip
art-a04e7b7ceae01a7ceda41419e4c639a43e18361e.tar.gz
art-a04e7b7ceae01a7ceda41419e4c639a43e18361e.tar.bz2
Run a simplification pass before code generation.
The code generators assume things that only the instruction simplier ensures. So it has to be run last in case previous optimiziations broke those assumptions. bug:21865464 (cherry picked from commit b2bdfce7f805b00668a2521b1c939a0aafb2be49) Change-Id: Ibf4384a911e400eb7586bbf6b4edd6351034cbd8
Diffstat (limited to 'test')
-rw-r--r--test/505-simplifier-type-propagation/expected.txt0
-rw-r--r--test/505-simplifier-type-propagation/info.txt3
-rw-r--r--test/505-simplifier-type-propagation/src/Main.java38
3 files changed, 41 insertions, 0 deletions
diff --git a/test/505-simplifier-type-propagation/expected.txt b/test/505-simplifier-type-propagation/expected.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/505-simplifier-type-propagation/expected.txt
diff --git a/test/505-simplifier-type-propagation/info.txt b/test/505-simplifier-type-propagation/info.txt
new file mode 100644
index 0000000..cd84432
--- /dev/null
+++ b/test/505-simplifier-type-propagation/info.txt
@@ -0,0 +1,3 @@
+Regression test for the optimizing compiler, where
+the code generators did not expect type conversion
+instructions from one type to the same type.
diff --git a/test/505-simplifier-type-propagation/src/Main.java b/test/505-simplifier-type-propagation/src/Main.java
new file mode 100644
index 0000000..780cb34
--- /dev/null
+++ b/test/505-simplifier-type-propagation/src/Main.java
@@ -0,0 +1,38 @@
+/*
+ * 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 Main {
+ public static void main(String[] args) {
+ byte result = bar((byte)2);
+ if (result != 2) {
+ throw new Error("Expected 2, got " + result);
+ }
+ }
+
+ public static byte bar(byte myByte) {
+ int a = 0;
+ // The following call will be inlined, which will make
+ // the type conversion below from byte to byte.
+ if ($inline$foo()) {
+ a = myByte;
+ }
+ return (byte)a;
+ }
+
+ public static boolean $inline$foo() {
+ return true;
+ }
+}