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.simpleLoop1(int) dead_code_elimination$initial (before) 20## CHECK-DAG: <<Constant:i\d+>> IntConstant 42 21## CHECK-DAG: Goto irreducible:true 22## CHECK-DAG: InvokeStaticOrDirect [<<Constant>>{{(,[ij]\d+)?}}] loop:none 23## CHECK-DAG: InvokeStaticOrDirect [{{i\d+}}{{(,[ij]\d+)?}}] loop:none 24.method public static simpleLoop1(I)I 25 .registers 3 26 const/16 v0, 42 27 invoke-static {v0}, LIrreducibleLoop;->$noinline$m(I)V 28 if-eqz p0, :b22 29 goto :b34 30 31 :b34 32 goto :b20 33 34 :b20 35 if-nez p0, :b45 36 goto :b46 37 38 :b46 39 goto :b21 40 41 :b21 42 goto :b34 43 44 :b22 45 :try_start 46 div-int v0, v0, v0 47 :try_end 48 .catchall {:try_start .. :try_end} :b34 49 goto :b20 50 51 :b45 52 invoke-static {v0}, LIrreducibleLoop;->$noinline$m(I)V 53 goto :b26 54 55 :b26 56 return v0 57.end method 58 59## CHECK-START-X86: int IrreducibleLoop.simpleLoop2(int) dead_code_elimination$initial (before) 60## CHECK-DAG: <<Constant:i\d+>> IntConstant 42 61## CHECK-DAG: Goto irreducible:true 62## CHECK-DAG: InvokeStaticOrDirect [<<Constant>>{{(,[ij]\d+)?}}] loop:none 63## CHECK-DAG: InvokeStaticOrDirect [{{i\d+}}{{(,[ij]\d+)?}}] loop:none 64.method public static simpleLoop2(I)I 65 .registers 3 66 const/16 v0, 42 67 68 :try_start1 69 invoke-static {v0}, LIrreducibleLoop;->$noinline$m(I)V 70 div-int v0, v0, v0 71 :try_end1 72 .catchall {:try_start1 .. :try_end1} :b14 73 74 :try_start2 75 invoke-static {v0}, LIrreducibleLoop;->$noinline$m(I)V 76 div-int v0, v0, v0 77 :try_end2 78 .catchall {:try_start2 .. :try_end2} :b45 79 goto :b49 80 81 :b14 82 goto :b15 83 84 :b45 85 goto :b15 86 87 :b15 88 goto :b16 89 90 :b16 91 goto :b49 92 93 :b49 94 invoke-static {v0}, LIrreducibleLoop;->$noinline$m(I)V 95 div-int v0, v0, v0 96 :try_end3 97 .catchall {:b49 .. :try_end3} :b49 98 if-eqz p0, :b16 99 goto :b26 100 101 :b26 102 return v0 103.end method 104 105.method public static $noinline$m(I)V 106 .registers 3 107 const/16 v0, 0 108 sget-boolean v1,LIrreducibleLoop;->doThrow:Z 109 if-eqz v1, :exit 110 # Prevent inlining. 111 throw v0 112 :exit 113 return-void 114.end method 115 116.field public static doThrow:Z 117