2 ; RUN: opt -inline -mtriple=aarch64--linux-gnu -mcpu=kryo -S -debug-only=inline-cost < %s 2>&1 | FileCheck %s
4 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
5 target triple = "aarch64--linux-gnu"
7 define void @outer1([4 x i32]* %ptr, i32 %i) {
8 call void @inner1([4 x i32]* %ptr, i32 %i)
12 define void @outer2([4 x i32]* %ptr, i32 %i) {
13 call void @inner2([4 x i32]* %ptr, i32 %i)
17 define void @outer3([4 x i32]* %ptr, i32 %j) {
18 call void @inner3([4 x i32]* %ptr, i32 0, i32 %j)
22 ; The gep in inner1() is reg+reg, which is a legal addressing mode for AArch64.
23 ; Thus, both the gep and ret can be simplified.
24 ; CHECK: Analyzing call of inner1
25 ; CHECK: NumInstructionsSimplified: 2
26 ; CHECK: NumInstructions: 2
27 define void @inner1([4 x i32]* %ptr, i32 %i) {
28 %G = getelementptr inbounds [4 x i32], [4 x i32]* %ptr, i32 0, i32 %i
32 ; The gep in inner2() is reg+imm+reg, which is not a legal addressing mode for
33 ; AArch64. Thus, only the ret can be simplified and not the gep.
34 ; CHECK: Analyzing call of inner2
35 ; CHECK: NumInstructionsSimplified: 1
36 ; CHECK: NumInstructions: 2
37 define void @inner2([4 x i32]* %ptr, i32 %i) {
38 %G = getelementptr inbounds [4 x i32], [4 x i32]* %ptr, i32 1, i32 %i
42 ; The gep in inner3() is reg+reg because %i is a known constant from the
43 ; callsite. This case is a legal addressing mode for AArch64. Thus, both the
44 ; gep and ret can be simplified.
45 ; CHECK: Analyzing call of inner3
46 ; CHECK: NumInstructionsSimplified: 2
47 ; CHECK: NumInstructions: 2
48 define void @inner3([4 x i32]* %ptr, i32 %i, i32 %j) {
49 %G = getelementptr inbounds [4 x i32], [4 x i32]* %ptr, i32 %i, i32 %j