Debian Codegraph @

test/530-checker-lse3/smali/StoreLoad.smali

raw
1 # Copyright (C) 2017 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 LStoreLoad;
16
17 .super Ljava/lang/Object;
18
19 ## CHECK-START: int StoreLoad.test(int) load_store_elimination (before)
20 ## CHECK-DAG: <<Arg:i\d+>> ParameterValue
21 ## CHECK-DAG: StaticFieldSet [{{l\d+}},<<Arg>>] field_name:StoreLoad.byteField
22 ## CHECK-DAG: StaticFieldSet [{{l\d+}},<<Arg>>] field_name:StoreLoad.byteField2
23 ## CHECK-DAG: <<Val:b\d+>> StaticFieldGet [{{l\d+}}] field_name:StoreLoad.byteField
24 ## CHECK-DAG: <<Val2:b\d+>> StaticFieldGet [{{l\d+}}] field_name:StoreLoad.byteField2
25 ## CHECK-DAG: <<Val3:i\d+>> Add [<<Val>>,<<Val2>>]
26 ## CHECK-DAG: Return [<<Val3>>]
27
28 ## CHECK-START: int StoreLoad.test(int) load_store_elimination (after)
29 ## CHECK-NOT: StaticFieldGet
30
31 ## CHECK-START: int StoreLoad.test(int) load_store_elimination (after)
32 ## CHECK-DAG: <<Arg:i\d+>> ParameterValue
33 ## CHECK-DAG: StaticFieldSet [{{l\d+}},<<Arg>>] field_name:StoreLoad.byteField
34 ## CHECK-DAG: StaticFieldSet [{{l\d+}},<<Arg>>] field_name:StoreLoad.byteField2
35 ## CHECK-DAG: <<Conv:b\d+>> TypeConversion [<<Arg>>]
36 ## CHECK-DAG: <<Val3:i\d+>> Add [<<Conv>>,<<Conv>>]
37 ## CHECK-DAG: Return [<<Val3>>]
38 .method public static test(I)I
39 .registers 2
40 sput-byte v1, LStoreLoad;->byteField:B
41 sput-byte v1, LStoreLoad;->byteField2:B
42 sget-byte v0, LStoreLoad;->byteField:B
43 sget-byte v1, LStoreLoad;->byteField2:B
44 add-int/2addr v0, v1
45 return v0
46 .end method
47
48 ## CHECK-START: int StoreLoad.test2(int) load_store_elimination (before)
49 ## CHECK-DAG: <<Arg:i\d+>> ParameterValue
50 ## CHECK-DAG: StaticFieldSet [{{l\d+}},<<Arg>>] field_name:StoreLoad.byteField
51 ## CHECK-DAG: Return [<<Arg>>]
52
53 ## CHECK-START: int StoreLoad.test2(int) load_store_elimination (after)
54 ## CHECK-NOT: TypeConversion
55 .method public static test2(I)I
56 .registers 1
57 sput-byte v0, LStoreLoad;->byteField:B
58 return v0
59 .end method
60
61 ## CHECK-START: int StoreLoad.test3(int) load_store_elimination (before)
62 ## CHECK-DAG: StaticFieldSet
63 ## CHECK-DAG: StaticFieldSet
64 ## CHECK-DAG: StaticFieldGet
65 ## CHECK-DAG: StaticFieldSet
66 ## CHECK-DAG: TypeConversion
67 ## CHECK-DAG: Phi
68 ## CHECK-DAG: StaticFieldGet
69
70 ## CHECK-START: int StoreLoad.test3(int) load_store_elimination (after)
71 ## CHECK-DAG: StaticFieldSet
72 ## CHECK-DAG: StaticFieldSet
73 ## CHECK-DAG: TypeConversion
74 ## CHECK-DAG: StaticFieldSet
75 ## CHECK-DAG: Phi
76 ## CHECK-DAG: Phi
77
78 ## CHECK-START: int StoreLoad.test3(int) load_store_elimination (after)
79 ## CHECK: Phi
80 ## CHECK: Phi
81 ## CHECK-NOT: Phi
82
83 ## CHECK-START: int StoreLoad.test3(int) load_store_elimination (after)
84 ## CHECK: TypeConversion
85 ## CHECK-NOT: TypeConversion
86
87 ## CHECK-START: int StoreLoad.test3(int) load_store_elimination (after)
88 ## CHECK-NOT: StaticFieldGet
89 .method public static test3(I)I
90 .registers 3
91 const/4 v0, 0
92 sput p0, LStoreLoad;->intField:I
93 and-int/lit8 v1, p0, 1
94 if-eqz v1, :skip
95
96 sput-byte p0, LStoreLoad;->byteField:B
97 sget-byte v1, LStoreLoad;->byteField:B
98 sput v1, LStoreLoad;->intField:I
99 # Test that this TypeConversion is moved and used for the
100 # sget-byte above instead of creating a new one.
101 int-to-byte v0, p0
102
103 :skip
104 sget v1, LStoreLoad;->intField:I
105 add-int v0, v1, v0
106 return v0
107 .end method
108
109 ## CHECK-START: int StoreLoad.test4(int) load_store_elimination (before)
110 ## CHECK-DAG: StaticFieldSet
111 ## CHECK-DAG: StaticFieldSet
112 ## CHECK-DAG: StaticFieldSet
113 ## CHECK-DAG: StaticFieldSet
114
115 ## CHECK-START: int StoreLoad.test4(int) load_store_elimination (after)
116 ## CHECK-DAG: StaticFieldSet
117 ## CHECK-DAG: StaticFieldSet
118 ## CHECK-DAG: StaticFieldSet
119 ## CHECK-DAG: StaticFieldSet
120 .method public static test4(I)I
121 # Test that stores are kept properly for an irreducible loop.
122 .registers 3
123 const/4 v0, 0
124 const/4 v1, 7
125 if-gt p0, v1, :skip1
126
127 const/4 v1, 1
128 sput v1, LStoreLoad;->intField:I
129 goto :irreducible_loop_middle
130
131 :skip1
132 const/4 v1, 2
133 sput v1, LStoreLoad;->intField:I
134 # Fall through to the irreducible loop
135
136 :irreducible_loop
137 const/4 v1, 3
138 sput v1, LStoreLoad;->intField:I
139 if-eq v0, p0, :end
140
141 :irreducible_loop_middle
142 const/4 v1, 4
143 sput v1, LStoreLoad;->intField:I
144 add-int/lit8 v0, v0, 1
145 goto :irreducible_loop
146
147 :end
148 return p0
149 .end method
150
151 .field public static intField:I
152 .field public static byteField:B
153 .field public static byteField2:B