diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/459-dead-phi/expected.txt | 1 | ||||
-rw-r--r-- | test/459-dead-phi/info.txt | 1 | ||||
-rw-r--r-- | test/459-dead-phi/smali/EquivalentPhi.smali | 41 | ||||
-rw-r--r-- | test/459-dead-phi/src/Main.java | 29 |
4 files changed, 72 insertions, 0 deletions
diff --git a/test/459-dead-phi/expected.txt b/test/459-dead-phi/expected.txt new file mode 100644 index 0000000..ba66466 --- /dev/null +++ b/test/459-dead-phi/expected.txt @@ -0,0 +1 @@ +0.0 diff --git a/test/459-dead-phi/info.txt b/test/459-dead-phi/info.txt new file mode 100644 index 0000000..3f82ecb --- /dev/null +++ b/test/459-dead-phi/info.txt @@ -0,0 +1 @@ +Regression test for optimizing when it is building the SSA form. diff --git a/test/459-dead-phi/smali/EquivalentPhi.smali b/test/459-dead-phi/smali/EquivalentPhi.smali new file mode 100644 index 0000000..4fa88a9 --- /dev/null +++ b/test/459-dead-phi/smali/EquivalentPhi.smali @@ -0,0 +1,41 @@ +# 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 LEquivalentPhi; + +.super Ljava/lang/Object; + +.method public static equivalentPhi([F)F + .registers 5 + const/4 v0, 0x0 + # aget is initally expected to be an int, but will + # rightly become a float after type propagation. + aget v1, p0, v0 + move v2, v1 + if-eq v0, v0, :else + move v2, v0 + :else + # v2 will be a phi with (int, int) as input + move v3, v2 + if-eq v0, v0, :else2 + move v3, v0 + # v3 will be a phi with (int, int) as input. + : else2 + # This instruction will lead to creating a phi equivalent + # for v3 with float type, which in turn will lead to creating + # a phi equivalent for v2 of type float. We used to forget to + # delete the old phi, which ends up having incompatible input + # types. + return v3 +.end method diff --git a/test/459-dead-phi/src/Main.java b/test/459-dead-phi/src/Main.java new file mode 100644 index 0000000..0ecc0bd --- /dev/null +++ b/test/459-dead-phi/src/Main.java @@ -0,0 +1,29 @@ +/* + * 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("EquivalentPhi"); + Method m = c.getMethod("equivalentPhi", float[].class); + System.out.println(m.invoke(null, new float[] { 0.0f })); + } +} |