| 1 |
# Copyright (C) 2022 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 |
# Back-edges in the ascii-art graphs are represented with dash '-'. |
| 20 |
# |
| 21 |
# Check that testDoNotInlineInner has a simple irreducible loop |
| 22 |
# |
| 23 |
# entry |
| 24 |
# / \ |
| 25 |
# / \ |
| 26 |
# loop_entry \ |
| 27 |
# / \- \ |
| 28 |
# try_start\- \ |
| 29 |
# other_loop_entry |
| 30 |
# |
| 31 |
# Consistency check: we didn't optimize away the irreducible loop |
| 32 |
## CHECK-START: java.lang.Object IrreducibleLoop.testDoNotInlineInner(java.lang.Object) register (after) |
| 33 |
## CHECK: irreducible:true |
| 34 |
# |
| 35 |
# We shouldn't inline `inner`. |
| 36 |
## CHECK-START: java.lang.Object IrreducibleLoop.testDoNotInlineInner(java.lang.Object) inliner (before) |
| 37 |
## CHECK: InvokeStaticOrDirect method_name:Main.inner |
| 38 |
# |
| 39 |
## CHECK-START: java.lang.Object IrreducibleLoop.testDoNotInlineInner(java.lang.Object) inliner (after) |
| 40 |
## CHECK: InvokeStaticOrDirect method_name:Main.inner |
| 41 |
.method public static testDoNotInlineInner(Ljava/lang/Object;)Ljava/lang/Object; |
| 42 |
.registers 3 |
| 43 |
const/16 v0, 42 |
| 44 |
const/16 v1, 21 |
| 45 |
# Irreducible loop |
| 46 |
if-eq v1, v0, :other_loop_entry |
| 47 |
:loop_entry |
| 48 |
if-ne v1, v0, :continue |
| 49 |
add-int v0, v0, v0 |
| 50 |
:other_loop_entry |
| 51 |
add-int v0, v0, v0 |
| 52 |
goto :loop_entry |
| 53 |
|
| 54 |
:continue |
| 55 |
invoke-static {p0}, LMain;->inner(Ljava/lang/Object;)Ljava/lang/Object; |
| 56 |
move-result-object v0 |
| 57 |
return-object v0 |
| 58 |
.end method |