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-X86: int IrreducibleLoop.simpleLoop(int) dead_code_elimination$initial (before) 20 ## CHECK-DAG: <<Constant:i\d+>> IntConstant 42 21 ## CHECK-DAG: InvokeStaticOrDirect [<<Constant>>] loop:{{B\d+}} irreducible:true 22 ## CHECK-DAG: InvokeStaticOrDirect [<<Constant>>] loop:none 23 .method public static simpleLoop(I)I 24 .registers 3 25 const/16 v0, 42 26 if-eqz p0, :loop_entry 27 goto :other_loop_pre_entry 28 29 # The then part: beginning of the irreducible loop. 30 :loop_entry 31 if-nez p0, :exit 32 invoke-static {v0},LIrreducibleLoop;->$noinline$m(I)V 33 :other_loop_entry 34 goto :loop_entry 35 36 # The else part: a block uses the ArtMethod and branches to 37 # a block that doesn't. The register allocator used to trip there, as the 38 # ArtMethod was a live_in of the last block before the loop, but did not have 39 # a location due to our liveness analysis. 40 :other_loop_pre_entry 41 if-eqz p0, :other_loop_entry 42 invoke-static {v0},LIrreducibleLoop;->$noinline$m(I)V 43 goto :other_loop_entry 44 45 :exit 46 return v0 47 .end method 48 49 .method public static $noinline$m(I)V 50 .registers 3 51 const/16 v0, 0 52 sget-boolean v1,LIrreducibleLoop;->doThrow:Z 53 if-eqz v1, :exit 54 # Prevent inlining. 55 throw v0 56 :exit 57 return-void 58 .end method 59 60 .field public static doThrow:Z 61