Home | History | Annotate | Download | only in smali
      1 # Copyright (C) 2016 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 LIrreducibleLoop;
     16 
     17 .super Ljava/lang/Object;
     18 
     19 ## CHECK-START: int IrreducibleLoop.test(int) GVN (before)
     20 ## CHECK-DAG:                     LoadClass loop:none
     21 ## CHECK-DAG:                     LoadClass loop:{{B\d+}} outer_loop:none
     22 
     23 ## CHECK-START: int IrreducibleLoop.test(int) GVN (after)
     24 ## CHECK-DAG:                     LoadClass loop:none
     25 ## CHECK-DAG:                     LoadClass loop:{{B\d+}} outer_loop:none
     26 .method public static test(I)I
     27    .registers 2
     28 
     29    sget v0, LIrreducibleLoop;->field1:I
     30    sput v0, LIrreducibleLoop;->field2:I
     31 
     32    if-eqz p0, :loop_entry
     33    goto :exit
     34 
     35    :loop_entry
     36    if-eqz p0, :irreducible_loop_entry
     37    sget v0, LIrreducibleLoop;->field2:I
     38    sput v0, LIrreducibleLoop;->field1:I
     39    if-eqz v0, :exit
     40    goto :irreducible_other_loop_entry
     41 
     42    :irreducible_loop_entry
     43    if-eqz p0, :loop_back_edge
     44    :irreducible_other_loop_entry
     45    if-eqz v0, :loop_back_edge
     46    goto :irreducible_loop_entry
     47 
     48    :loop_back_edge
     49    goto :loop_entry
     50 
     51    :exit
     52    return v0
     53 .end method
     54 
     55 .field public static field1:I
     56 .field public static field2:I
     57