Home | History | Annotate | Download | only in smali
      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 .class public LSmali;
     15 .super Ljava/lang/Object;
     16 
     17 ## CHECK-START: int Smali.foo(int, int) GVN (before)
     18 ## CHECK: Add
     19 ## CHECK: Add
     20 ## CHECK: Add
     21 
     22 ## CHECK-START: int Smali.foo(int, int) GVN (after)
     23 ## CHECK: Add
     24 ## CHECK: Add
     25 ## CHECK-NOT: Add
     26 .method public static foo(II)I
     27 
     28     # int sum1 = x + y;
     29     # int sum2 = y + x;
     30     # return sum1 + sum2;
     31 
     32     .registers 5
     33     .param p0, "x"    # I
     34     .param p1, "y"    # I
     35 
     36     add-int v0, p0, p1
     37     add-int v1, p1, p0
     38     add-int v2, v0, v1
     39 
     40     return v2
     41 .end method
     42 
     43