1# Copyright (C) 2015 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15.class public LEquivalentPhi;
16
17.super Ljava/lang/Object;
18
19.method public static equivalentPhi([F)F
20   .registers 5
21   const/4 v0, 0x0
22   # aget is initally expected to be an int, but will
23   # rightly become a float after type propagation.
24   aget v1, p0, v0
25   move v2, v1
26   if-eq v0, v0, :else
27   move v2, v0
28   :else
29   # v2 will be a phi with (int, int) as input
30   move v3, v2
31   if-eq v0, v0, :else2
32   move v3, v0
33   # v3 will be a phi with (int, int) as input.
34   : else2
35   # This instruction will lead to creating a phi equivalent
36   # for v3 with float type, which in turn will lead to creating
37   # a phi equivalent for v2 of type float. We used to forget to
38   # delete the old phi, which ends up having incompatible input
39   # types.
40   return v3
41.end method
42