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 .field public static byteField:B 62 .field public static byteField2:B 63