2 ; RUN: opt -passes=inline -mtriple=x86_64-unknown-unknown -S -debug-only=inline-cost < %s 2>&1 | FileCheck %s
4 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
5 target triple = "x86_64-unknown-unknown"
7 define i32 @outer1(ptr %ptr, i32 %i) {
8 %C = call i32 @inner1(ptr %ptr, i32 %i)
12 ; zext from i32 to i64 is free.
13 ; CHECK: Analyzing call of inner1
14 ; CHECK: NumInstructionsSimplified: 3
15 ; CHECK: NumInstructions: 4
16 define i32 @inner1(ptr %ptr, i32 %i) {
17 %E = zext i32 %i to i64
18 %G = getelementptr inbounds i32, ptr %ptr, i64 %E
23 define i16 @outer2(ptr %ptr) {
24 %C = call i16 @inner2(ptr %ptr)
29 ; CHECK: Analyzing call of inner2
30 ; CHECK: NumInstructionsSimplified: 2
31 ; CHECK: NumInstructions: 3
32 define i16 @inner2(ptr %ptr) {
33 %L = load i8, ptr %ptr
34 %E = zext i8 %L to i16
38 define i16 @outer3(ptr %ptr) {
39 %C = call i16 @inner3(ptr %ptr)
44 ; CHECK: Analyzing call of inner3
45 ; CHECK: NumInstructionsSimplified: 2
46 ; CHECK: NumInstructions: 3
47 define i16 @inner3(ptr %ptr) {
48 %L = load i8, ptr %ptr
49 %E = sext i8 %L to i16
53 define i32 @outer4(ptr %ptr) {
54 %C = call i32 @inner4(ptr %ptr)
59 ; CHECK: Analyzing call of inner4
60 ; CHECK: NumInstructionsSimplified: 2
61 ; CHECK: NumInstructions: 3
62 define i32 @inner4(ptr %ptr) {
63 %L = load i8, ptr %ptr
64 %E = zext i8 %L to i32
68 define i32 @outer5(ptr %ptr) {
69 %C = call i32 @inner5(ptr %ptr)
74 ; CHECK: Analyzing call of inner5
75 ; CHECK: NumInstructionsSimplified: 2
76 ; CHECK: NumInstructions: 3
77 define i32 @inner5(ptr %ptr) {
78 %L = load i8, ptr %ptr
79 %E = sext i8 %L to i32
83 define i32 @outer6(ptr %ptr) {
84 %C = call i32 @inner6(ptr %ptr)
89 ; CHECK: Analyzing call of inner6
90 ; CHECK: NumInstructionsSimplified: 2
91 ; CHECK: NumInstructions: 3
92 define i32 @inner6(ptr %ptr) {
93 %L = load i16, ptr %ptr
94 %E = zext i16 %L to i32
98 define i32 @outer7(ptr %ptr) {
99 %C = call i32 @inner7(ptr %ptr)
104 ; CHECK: Analyzing call of inner7
105 ; CHECK: NumInstructionsSimplified: 2
106 ; CHECK: NumInstructions: 3
107 define i32 @inner7(ptr %ptr) {
108 %L = load i16, ptr %ptr
109 %E = sext i16 %L to i32
113 define i64 @outer8(ptr %ptr) {
114 %C = call i64 @inner8(ptr %ptr)
119 ; CHECK: Analyzing call of inner8
120 ; CHECK: NumInstructionsSimplified: 2
121 ; CHECK: NumInstructions: 3
122 define i64 @inner8(ptr %ptr) {
123 %L = load i8, ptr %ptr
124 %E = zext i8 %L to i64
128 define i64 @outer9(ptr %ptr) {
129 %C = call i64 @inner9(ptr %ptr)
134 ; CHECK: Analyzing call of inner9
135 ; CHECK: NumInstructionsSimplified: 2
136 ; CHECK: NumInstructions: 3
137 define i64 @inner9(ptr %ptr) {
138 %L = load i8, ptr %ptr
139 %E = sext i8 %L to i64
143 define i64 @outer10(ptr %ptr) {
144 %C = call i64 @inner10(ptr %ptr)
149 ; CHECK: Analyzing call of inner10
150 ; CHECK: NumInstructionsSimplified: 2
151 ; CHECK: NumInstructions: 3
152 define i64 @inner10(ptr %ptr) {
153 %L = load i16, ptr %ptr
154 %E = zext i16 %L to i64
158 define i64 @outer11(ptr %ptr) {
159 %C = call i64 @inner11(ptr %ptr)
164 ; CHECK: Analyzing call of inner11
165 ; CHECK: NumInstructionsSimplified: 2
166 ; CHECK: NumInstructions: 3
167 define i64 @inner11(ptr %ptr) {
168 %L = load i16, ptr %ptr
169 %E = sext i16 %L to i64
173 define i64 @outer12(ptr %ptr) {
174 %C = call i64 @inner12(ptr %ptr)
179 ; CHECK: Analyzing call of inner12
180 ; CHECK: NumInstructionsSimplified: 2
181 ; CHECK: NumInstructions: 3
182 define i64 @inner12(ptr %ptr) {
183 %L = load i32, ptr %ptr
184 %E = zext i32 %L to i64
188 define i64 @outer13(ptr %ptr) {
189 %C = call i64 @inner13(ptr %ptr)
194 ; CHECK: Analyzing call of inner13
195 ; CHECK: NumInstructionsSimplified: 2
196 ; CHECK: NumInstructions: 3
197 define i64 @inner13(ptr %ptr) {
198 %L = load i32, ptr %ptr
199 %E = sext i32 %L to i64