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