diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/505-simplifier-type-propagation/expected.txt | 0 | ||||
-rw-r--r-- | test/505-simplifier-type-propagation/info.txt | 3 | ||||
-rw-r--r-- | test/505-simplifier-type-propagation/src/Main.java | 38 |
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; + } +} |