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