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