1 ; RUN: opt < %s -passes=inline -S | FileCheck %s
2 ; RUN: opt < %s -passes='cgscc(inline)' -S | FileCheck %s
3 target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
5 define i32 @noattr_callee(i32 %i) {
9 define i32 @sanitize_address_callee(i32 %i) sanitize_address {
13 define i32 @sanitize_hwaddress_callee(i32 %i) sanitize_hwaddress {
17 define i32 @sanitize_thread_callee(i32 %i) sanitize_thread {
21 define i32 @sanitize_memory_callee(i32 %i) sanitize_memory {
25 define i32 @sanitize_memtag_callee(i32 %i) sanitize_memtag {
29 define i32 @safestack_callee(i32 %i) safestack {
33 define i32 @slh_callee(i32 %i) speculative_load_hardening {
37 define i32 @alwaysinline_callee(i32 %i) alwaysinline {
41 define i32 @alwaysinline_sanitize_address_callee(i32 %i) alwaysinline sanitize_address {
45 define i32 @alwaysinline_sanitize_hwaddress_callee(i32 %i) alwaysinline sanitize_hwaddress {
49 define i32 @alwaysinline_sanitize_thread_callee(i32 %i) alwaysinline sanitize_thread {
53 define i32 @alwaysinline_sanitize_memory_callee(i32 %i) alwaysinline sanitize_memory {
57 define i32 @alwaysinline_sanitize_memtag_callee(i32 %i) alwaysinline sanitize_memtag {
61 define i32 @alwaysinline_safestack_callee(i32 %i) alwaysinline safestack {
67 ; * noattr callee is inlined into noattr caller,
68 ; * sanitize_(address|memory|thread) callee is not inlined into noattr caller,
69 ; * alwaysinline callee is always inlined no matter what sanitize_* attributes are present.
71 define i32 @test_no_sanitize_address(i32 %arg) {
72 %x1 = call i32 @noattr_callee(i32 %arg)
73 %x2 = call i32 @sanitize_address_callee(i32 %x1)
74 %x3 = call i32 @alwaysinline_callee(i32 %x2)
75 %x4 = call i32 @alwaysinline_sanitize_address_callee(i32 %x3)
77 ; CHECK-LABEL: @test_no_sanitize_address(
78 ; CHECK-NEXT: @sanitize_address_callee
82 define i32 @test_no_sanitize_hwaddress(i32 %arg) {
83 %x1 = call i32 @noattr_callee(i32 %arg)
84 %x2 = call i32 @sanitize_hwaddress_callee(i32 %x1)
85 %x3 = call i32 @alwaysinline_callee(i32 %x2)
86 %x4 = call i32 @alwaysinline_sanitize_hwaddress_callee(i32 %x3)
88 ; CHECK-LABEL: @test_no_sanitize_hwaddress(
89 ; CHECK-NEXT: @sanitize_hwaddress_callee
93 define i32 @test_no_sanitize_memory(i32 %arg) {
94 %x1 = call i32 @noattr_callee(i32 %arg)
95 %x2 = call i32 @sanitize_memory_callee(i32 %x1)
96 %x3 = call i32 @alwaysinline_callee(i32 %x2)
97 %x4 = call i32 @alwaysinline_sanitize_memory_callee(i32 %x3)
99 ; CHECK-LABEL: @test_no_sanitize_memory(
100 ; CHECK-NEXT: @sanitize_memory_callee
101 ; CHECK-NEXT: ret i32
104 define i32 @test_no_sanitize_thread(i32 %arg) {
105 %x1 = call i32 @noattr_callee(i32 %arg)
106 %x2 = call i32 @sanitize_thread_callee(i32 %x1)
107 %x3 = call i32 @alwaysinline_callee(i32 %x2)
108 %x4 = call i32 @alwaysinline_sanitize_thread_callee(i32 %x3)
110 ; CHECK-LABEL: @test_no_sanitize_thread(
111 ; CHECK-NEXT: @sanitize_thread_callee
112 ; CHECK-NEXT: ret i32
115 define i32 @test_no_sanitize_memtag(i32 %arg) {
116 %x1 = call i32 @noattr_callee(i32 %arg)
117 %x2 = call i32 @sanitize_memtag_callee(i32 %x1)
118 %x3 = call i32 @alwaysinline_callee(i32 %x2)
119 %x4 = call i32 @alwaysinline_sanitize_memtag_callee(i32 %x3)
121 ; CHECK-LABEL: @test_no_sanitize_memtag(
122 ; CHECK-NEXT: @sanitize_memtag_callee
123 ; CHECK-NEXT: ret i32
128 ; * noattr callee is not inlined into sanitize_(address|memory|thread) caller,
129 ; * sanitize_(address|memory|thread) callee is inlined into the caller with the same attribute,
130 ; * alwaysinline callee is always inlined no matter what sanitize_* attributes are present.
132 define i32 @test_sanitize_address(i32 %arg) sanitize_address {
133 %x1 = call i32 @noattr_callee(i32 %arg)
134 %x2 = call i32 @sanitize_address_callee(i32 %x1)
135 %x3 = call i32 @alwaysinline_callee(i32 %x2)
136 %x4 = call i32 @alwaysinline_sanitize_address_callee(i32 %x3)
138 ; CHECK-LABEL: @test_sanitize_address(
139 ; CHECK-NEXT: @noattr_callee
140 ; CHECK-NEXT: ret i32
143 define i32 @test_sanitize_hwaddress(i32 %arg) sanitize_hwaddress {
144 %x1 = call i32 @noattr_callee(i32 %arg)
145 %x2 = call i32 @sanitize_hwaddress_callee(i32 %x1)
146 %x3 = call i32 @alwaysinline_callee(i32 %x2)
147 %x4 = call i32 @alwaysinline_sanitize_hwaddress_callee(i32 %x3)
149 ; CHECK-LABEL: @test_sanitize_hwaddress(
150 ; CHECK-NEXT: @noattr_callee
151 ; CHECK-NEXT: ret i32
154 define i32 @test_sanitize_memory(i32 %arg) sanitize_memory {
155 %x1 = call i32 @noattr_callee(i32 %arg)
156 %x2 = call i32 @sanitize_memory_callee(i32 %x1)
157 %x3 = call i32 @alwaysinline_callee(i32 %x2)
158 %x4 = call i32 @alwaysinline_sanitize_memory_callee(i32 %x3)
160 ; CHECK-LABEL: @test_sanitize_memory(
161 ; CHECK-NEXT: @noattr_callee
162 ; CHECK-NEXT: ret i32
165 define i32 @test_sanitize_thread(i32 %arg) sanitize_thread {
166 %x1 = call i32 @noattr_callee(i32 %arg)
167 %x2 = call i32 @sanitize_thread_callee(i32 %x1)
168 %x3 = call i32 @alwaysinline_callee(i32 %x2)
169 %x4 = call i32 @alwaysinline_sanitize_thread_callee(i32 %x3)
171 ; CHECK-LABEL: @test_sanitize_thread(
172 ; CHECK-NEXT: @noattr_callee
173 ; CHECK-NEXT: ret i32
176 define i32 @test_sanitize_memtag(i32 %arg) sanitize_memtag {
177 %x1 = call i32 @noattr_callee(i32 %arg)
178 %x2 = call i32 @sanitize_memtag_callee(i32 %x1)
179 %x3 = call i32 @alwaysinline_callee(i32 %x2)
180 %x4 = call i32 @alwaysinline_sanitize_memtag_callee(i32 %x3)
182 ; CHECK-LABEL: @test_sanitize_memtag(
183 ; CHECK-NEXT: @noattr_callee
184 ; CHECK-NEXT: ret i32
187 define i32 @test_safestack(i32 %arg) safestack {
188 %x1 = call i32 @noattr_callee(i32 %arg)
189 %x2 = call i32 @safestack_callee(i32 %x1)
190 %x3 = call i32 @alwaysinline_callee(i32 %x2)
191 %x4 = call i32 @alwaysinline_safestack_callee(i32 %x3)
193 ; CHECK-LABEL: @test_safestack(
194 ; CHECK-NEXT: @noattr_callee
195 ; CHECK-NEXT: ret i32
198 ; Can inline a normal function into an SLH'ed function.
199 define i32 @test_caller_slh(i32 %i) speculative_load_hardening {
200 ; CHECK-LABEL: @test_caller_slh(
201 ; CHECK-SAME: ) [[SLH:.*]] {
205 %callee = call i32 @noattr_callee(i32 %i)
209 ; Can inline a SLH'ed function into a normal one, propagating SLH.
210 define i32 @test_callee_slh(i32 %i) {
211 ; CHECK-LABEL: @test_callee_slh(
212 ; CHECK-SAME: ) [[SLH:.*]] {
216 %callee = call i32 @slh_callee(i32 %i)
220 ; Check that a function doesn't get inlined if target-cpu strings don't match
222 define i32 @test_target_cpu_callee0(i32 %i) "target-cpu"="corei7" {
226 define i32 @test_target_cpu0(i32 %i) "target-cpu"="corei7" {
227 %1 = call i32 @test_target_cpu_callee0(i32 %i)
229 ; CHECK-LABEL: @test_target_cpu0(
230 ; CHECK-NOT: @test_target_cpu_callee0
233 define i32 @test_target_cpu_callee1(i32 %i) "target-cpu"="x86-64" {
237 define i32 @test_target_cpu1(i32 %i) "target-cpu"="corei7" {
238 %1 = call i32 @test_target_cpu_callee1(i32 %i)
240 ; CHECK-LABEL: @test_target_cpu1(
241 ; CHECK-NEXT: @test_target_cpu_callee1
242 ; CHECK-NEXT: ret i32
245 ; Check that a function doesn't get inlined if target-features strings don't
247 define i32 @test_target_features_callee0(i32 %i) "target-features"="+sse4.2" {
251 define i32 @test_target_features0(i32 %i) "target-features"="+sse4.2" {
252 %1 = call i32 @test_target_features_callee0(i32 %i)
254 ; CHECK-LABEL: @test_target_features0(
255 ; CHECK-NOT: @test_target_features_callee0
258 define i32 @test_target_features_callee1(i32 %i) "target-features"="+avx2" {
262 define i32 @test_target_features1(i32 %i) "target-features"="+sse4.2" {
263 %1 = call i32 @test_target_features_callee1(i32 %i)
265 ; CHECK-LABEL: @test_target_features1(
266 ; CHECK-NEXT: @test_target_features_callee1
267 ; CHECK-NEXT: ret i32
270 define i32 @less-precise-fpmad_callee0(i32 %i) "less-precise-fpmad"="false" {
272 ; CHECK: @less-precise-fpmad_callee0(i32 %i) [[FPMAD_FALSE:#[0-9]+]] {
273 ; CHECK-NEXT: ret i32
276 define i32 @less-precise-fpmad_callee1(i32 %i) "less-precise-fpmad"="true" {
278 ; CHECK: @less-precise-fpmad_callee1(i32 %i) [[FPMAD_TRUE:#[0-9]+]] {
279 ; CHECK-NEXT: ret i32
282 define i32 @test_less-precise-fpmad0(i32 %i) "less-precise-fpmad"="false" {
283 %1 = call i32 @less-precise-fpmad_callee0(i32 %i)
285 ; CHECK: @test_less-precise-fpmad0(i32 %i) [[FPMAD_FALSE]] {
286 ; CHECK-NEXT: ret i32
289 define i32 @test_less-precise-fpmad1(i32 %i) "less-precise-fpmad"="false" {
290 %1 = call i32 @less-precise-fpmad_callee1(i32 %i)
292 ; CHECK: @test_less-precise-fpmad1(i32 %i) [[FPMAD_FALSE]] {
293 ; CHECK-NEXT: ret i32
296 define i32 @test_less-precise-fpmad2(i32 %i) "less-precise-fpmad"="true" {
297 %1 = call i32 @less-precise-fpmad_callee0(i32 %i)
299 ; CHECK: @test_less-precise-fpmad2(i32 %i) [[FPMAD_FALSE]] {
300 ; CHECK-NEXT: ret i32
303 define i32 @test_less-precise-fpmad3(i32 %i) "less-precise-fpmad"="true" {
304 %1 = call i32 @less-precise-fpmad_callee1(i32 %i)
306 ; CHECK: @test_less-precise-fpmad3(i32 %i) [[FPMAD_TRUE]] {
307 ; CHECK-NEXT: ret i32
310 define i32 @no-implicit-float_callee0(i32 %i) {
312 ; CHECK: @no-implicit-float_callee0(i32 %i) {
313 ; CHECK-NEXT: ret i32
316 define i32 @no-implicit-float_callee1(i32 %i) noimplicitfloat {
318 ; CHECK: @no-implicit-float_callee1(i32 %i) [[NOIMPLICITFLOAT:#[0-9]+]] {
319 ; CHECK-NEXT: ret i32
322 define i32 @test_no-implicit-float0(i32 %i) {
323 %1 = call i32 @no-implicit-float_callee0(i32 %i)
325 ; CHECK: @test_no-implicit-float0(i32 %i) {
326 ; CHECK-NEXT: ret i32
329 define i32 @test_no-implicit-float1(i32 %i) {
330 %1 = call i32 @no-implicit-float_callee1(i32 %i)
332 ; CHECK: @test_no-implicit-float1(i32 %i) [[NOIMPLICITFLOAT]] {
333 ; CHECK-NEXT: ret i32
336 define i32 @test_no-implicit-float2(i32 %i) noimplicitfloat {
337 %1 = call i32 @no-implicit-float_callee0(i32 %i)
339 ; CHECK: @test_no-implicit-float2(i32 %i) [[NOIMPLICITFLOAT]] {
340 ; CHECK-NEXT: ret i32
343 define i32 @test_no-implicit-float3(i32 %i) noimplicitfloat {
344 %1 = call i32 @no-implicit-float_callee1(i32 %i)
346 ; CHECK: @test_no-implicit-float3(i32 %i) [[NOIMPLICITFLOAT]] {
347 ; CHECK-NEXT: ret i32
350 ; Check that no-jump-tables flag propagates from inlined callee to caller
352 define i32 @no-use-jump-tables_callee0(i32 %i) {
354 ; CHECK: @no-use-jump-tables_callee0(i32 %i) {
355 ; CHECK-NEXT: ret i32
358 define i32 @no-use-jump-tables_callee1(i32 %i) "no-jump-tables"="true" {
360 ; CHECK: @no-use-jump-tables_callee1(i32 %i) [[NOUSEJUMPTABLES:#[0-9]+]] {
361 ; CHECK-NEXT: ret i32
364 define i32 @test_no-use-jump-tables0(i32 %i) {
365 %1 = call i32 @no-use-jump-tables_callee0(i32 %i)
367 ; CHECK: @test_no-use-jump-tables0(i32 %i) {
368 ; CHECK-NEXT: ret i32
371 define i32 @test_no-use-jump-tables1(i32 %i) {
372 %1 = call i32 @no-use-jump-tables_callee1(i32 %i)
374 ; CHECK: @test_no-use-jump-tables1(i32 %i) [[NOUSEJUMPTABLES]] {
375 ; CHECK-NEXT: ret i32
378 define i32 @test_no-use-jump-tables2(i32 %i) "no-jump-tables"="true" {
379 %1 = call i32 @no-use-jump-tables_callee0(i32 %i)
381 ; CHECK: @test_no-use-jump-tables2(i32 %i) [[NOUSEJUMPTABLES]] {
382 ; CHECK-NEXT: ret i32
385 define i32 @test_no-use-jump-tables3(i32 %i) "no-jump-tables"="true" {
386 %1 = call i32 @no-use-jump-tables_callee1(i32 %i)
388 ; CHECK: @test_no-use-jump-tables3(i32 %i) [[NOUSEJUMPTABLES]] {
389 ; CHECK-NEXT: ret i32
392 ; Callee with null_pointer_is_valid attribute should not be inlined
393 ; into a caller without this attribute.
394 ; Exception: alwaysinline callee can still be inlined but
395 ; null_pointer_is_valid should get copied to caller.
397 define i32 @null-pointer-is-valid_callee0(i32 %i) null_pointer_is_valid {
399 ; CHECK: @null-pointer-is-valid_callee0(i32 %i)
400 ; CHECK-NEXT: ret i32
403 define i32 @null-pointer-is-valid_callee1(i32 %i) alwaysinline null_pointer_is_valid {
405 ; CHECK: @null-pointer-is-valid_callee1(i32 %i)
406 ; CHECK-NEXT: ret i32
409 define i32 @null-pointer-is-valid_callee2(i32 %i) {
411 ; CHECK: @null-pointer-is-valid_callee2(i32 %i)
412 ; CHECK-NEXT: ret i32
415 ; No inlining since caller does not have null_pointer_is_valid attribute.
416 define i32 @test_null-pointer-is-valid0(i32 %i) {
417 %1 = call i32 @null-pointer-is-valid_callee0(i32 %i)
419 ; CHECK: @test_null-pointer-is-valid0(
420 ; CHECK: call i32 @null-pointer-is-valid_callee0
421 ; CHECK-NEXT: ret i32
424 ; alwaysinline should force inlining even when caller does not have
425 ; null_pointer_is_valid attribute. However, the attribute should be
427 define i32 @test_null-pointer-is-valid1(i32 %i) {
428 %1 = call i32 @null-pointer-is-valid_callee1(i32 %i)
430 ; CHECK: @test_null-pointer-is-valid1(i32 %i) [[NULLPOINTERISVALID:#[0-9]+]] {
431 ; CHECK-NEXT: ret i32
434 ; Can inline since both caller and callee have null_pointer_is_valid
436 define i32 @test_null-pointer-is-valid2(i32 %i) null_pointer_is_valid {
437 %1 = call i32 @null-pointer-is-valid_callee2(i32 %i)
439 ; CHECK: @test_null-pointer-is-valid2(i32 %i) [[NULLPOINTERISVALID]] {
440 ; CHECK-NEXT: ret i32
443 define i32 @no-infs-fp-math_callee0(i32 %i) "no-infs-fp-math"="false" {
445 ; CHECK: @no-infs-fp-math_callee0(i32 %i) [[NO_INFS_FPMATH_FALSE:#[0-9]+]] {
446 ; CHECK-NEXT: ret i32
449 define i32 @no-infs-fp-math_callee1(i32 %i) "no-infs-fp-math"="true" {
451 ; CHECK: @no-infs-fp-math_callee1(i32 %i) [[NO_INFS_FPMATH_TRUE:#[0-9]+]] {
452 ; CHECK-NEXT: ret i32
455 define i32 @test_no-infs-fp-math0(i32 %i) "no-infs-fp-math"="false" {
456 %1 = call i32 @no-infs-fp-math_callee0(i32 %i)
458 ; CHECK: @test_no-infs-fp-math0(i32 %i) [[NO_INFS_FPMATH_FALSE]] {
459 ; CHECK-NEXT: ret i32
462 define i32 @test_no-infs-fp-math1(i32 %i) "no-infs-fp-math"="false" {
463 %1 = call i32 @no-infs-fp-math_callee1(i32 %i)
465 ; CHECK: @test_no-infs-fp-math1(i32 %i) [[NO_INFS_FPMATH_FALSE]] {
466 ; CHECK-NEXT: ret i32
469 define i32 @test_no-infs-fp-math2(i32 %i) "no-infs-fp-math"="true" {
470 %1 = call i32 @no-infs-fp-math_callee0(i32 %i)
472 ; CHECK: @test_no-infs-fp-math2(i32 %i) [[NO_INFS_FPMATH_FALSE]] {
473 ; CHECK-NEXT: ret i32
476 define i32 @test_no-infs-fp-math3(i32 %i) "no-infs-fp-math"="true" {
477 %1 = call i32 @no-infs-fp-math_callee1(i32 %i)
479 ; CHECK: @test_no-infs-fp-math3(i32 %i) [[NO_INFS_FPMATH_TRUE]] {
480 ; CHECK-NEXT: ret i32
483 define i32 @no-nans-fp-math_callee0(i32 %i) "no-nans-fp-math"="false" {
485 ; CHECK: @no-nans-fp-math_callee0(i32 %i) [[NO_NANS_FPMATH_FALSE:#[0-9]+]] {
486 ; CHECK-NEXT: ret i32
489 define i32 @no-nans-fp-math_callee1(i32 %i) "no-nans-fp-math"="true" {
491 ; CHECK: @no-nans-fp-math_callee1(i32 %i) [[NO_NANS_FPMATH_TRUE:#[0-9]+]] {
492 ; CHECK-NEXT: ret i32
495 define i32 @test_no-nans-fp-math0(i32 %i) "no-nans-fp-math"="false" {
496 %1 = call i32 @no-nans-fp-math_callee0(i32 %i)
498 ; CHECK: @test_no-nans-fp-math0(i32 %i) [[NO_NANS_FPMATH_FALSE]] {
499 ; CHECK-NEXT: ret i32
502 define i32 @test_no-nans-fp-math1(i32 %i) "no-nans-fp-math"="false" {
503 %1 = call i32 @no-nans-fp-math_callee1(i32 %i)
505 ; CHECK: @test_no-nans-fp-math1(i32 %i) [[NO_NANS_FPMATH_FALSE]] {
506 ; CHECK-NEXT: ret i32
509 define i32 @test_no-nans-fp-math2(i32 %i) "no-nans-fp-math"="true" {
510 %1 = call i32 @no-nans-fp-math_callee0(i32 %i)
512 ; CHECK: @test_no-nans-fp-math2(i32 %i) [[NO_NANS_FPMATH_FALSE]] {
513 ; CHECK-NEXT: ret i32
516 define i32 @test_no-nans-fp-math3(i32 %i) "no-nans-fp-math"="true" {
517 %1 = call i32 @no-nans-fp-math_callee1(i32 %i)
519 ; CHECK: @test_no-nans-fp-math3(i32 %i) [[NO_NANS_FPMATH_TRUE]] {
520 ; CHECK-NEXT: ret i32
523 define i32 @no-signed-zeros-fp-math_callee0(i32 %i) "no-signed-zeros-fp-math"="false" {
525 ; CHECK: @no-signed-zeros-fp-math_callee0(i32 %i) [[NO_SIGNED_ZEROS_FPMATH_FALSE:#[0-9]+]] {
526 ; CHECK-NEXT: ret i32
529 define i32 @no-signed-zeros-fp-math_callee1(i32 %i) "no-signed-zeros-fp-math"="true" {
531 ; CHECK: @no-signed-zeros-fp-math_callee1(i32 %i) [[NO_SIGNED_ZEROS_FPMATH_TRUE:#[0-9]+]] {
532 ; CHECK-NEXT: ret i32
535 define i32 @test_no-signed-zeros-fp-math0(i32 %i) "no-signed-zeros-fp-math"="false" {
536 %1 = call i32 @no-signed-zeros-fp-math_callee0(i32 %i)
538 ; CHECK: @test_no-signed-zeros-fp-math0(i32 %i) [[NO_SIGNED_ZEROS_FPMATH_FALSE]] {
539 ; CHECK-NEXT: ret i32
542 define i32 @test_no-signed-zeros-fp-math1(i32 %i) "no-signed-zeros-fp-math"="false" {
543 %1 = call i32 @no-signed-zeros-fp-math_callee1(i32 %i)
545 ; CHECK: @test_no-signed-zeros-fp-math1(i32 %i) [[NO_SIGNED_ZEROS_FPMATH_FALSE]] {
546 ; CHECK-NEXT: ret i32
549 define i32 @test_no-signed-zeros-fp-math2(i32 %i) "no-signed-zeros-fp-math"="true" {
550 %1 = call i32 @no-signed-zeros-fp-math_callee0(i32 %i)
552 ; CHECK: @test_no-signed-zeros-fp-math2(i32 %i) [[NO_SIGNED_ZEROS_FPMATH_FALSE]] {
553 ; CHECK-NEXT: ret i32
556 define i32 @test_no-signed-zeros-fp-math3(i32 %i) "no-signed-zeros-fp-math"="true" {
557 %1 = call i32 @no-signed-zeros-fp-math_callee1(i32 %i)
559 ; CHECK: @test_no-signed-zeros-fp-math3(i32 %i) [[NO_SIGNED_ZEROS_FPMATH_TRUE]] {
560 ; CHECK-NEXT: ret i32
563 define i32 @unsafe-fp-math_callee0(i32 %i) "unsafe-fp-math"="false" {
565 ; CHECK: @unsafe-fp-math_callee0(i32 %i) [[UNSAFE_FPMATH_FALSE:#[0-9]+]] {
566 ; CHECK-NEXT: ret i32
569 define i32 @unsafe-fp-math_callee1(i32 %i) "unsafe-fp-math"="true" {
571 ; CHECK: @unsafe-fp-math_callee1(i32 %i) [[UNSAFE_FPMATH_TRUE:#[0-9]+]] {
572 ; CHECK-NEXT: ret i32
575 define i32 @test_unsafe-fp-math0(i32 %i) "unsafe-fp-math"="false" {
576 %1 = call i32 @unsafe-fp-math_callee0(i32 %i)
578 ; CHECK: @test_unsafe-fp-math0(i32 %i) [[UNSAFE_FPMATH_FALSE]] {
579 ; CHECK-NEXT: ret i32
582 define i32 @test_unsafe-fp-math1(i32 %i) "unsafe-fp-math"="false" {
583 %1 = call i32 @unsafe-fp-math_callee1(i32 %i)
585 ; CHECK: @test_unsafe-fp-math1(i32 %i) [[UNSAFE_FPMATH_FALSE]] {
586 ; CHECK-NEXT: ret i32
589 define i32 @test_unsafe-fp-math2(i32 %i) "unsafe-fp-math"="true" {
590 %1 = call i32 @unsafe-fp-math_callee0(i32 %i)
592 ; CHECK: @test_unsafe-fp-math2(i32 %i) [[UNSAFE_FPMATH_FALSE]] {
593 ; CHECK-NEXT: ret i32
596 define i32 @test_unsafe-fp-math3(i32 %i) "unsafe-fp-math"="true" {
597 %1 = call i32 @unsafe-fp-math_callee1(i32 %i)
599 ; CHECK: @test_unsafe-fp-math3(i32 %i) [[UNSAFE_FPMATH_TRUE]] {
600 ; CHECK-NEXT: ret i32
603 ; Test that fn_ret_thunk_extern has no CompatRule; inlining is permitted.
604 ; Test that fn_ret_thunk_extern has no MergeRule; fn_ret_thunk_extern is not
605 ; propagated or dropped on the caller after inlining.
606 define i32 @thunk_extern_callee() fn_ret_thunk_extern {
607 ; CHECK: @thunk_extern_callee() [[FNRETTHUNK_EXTERN:#[0-9]+]]
611 define i32 @thunk_keep_caller() {
612 ; CHECK: @thunk_keep_caller() {
613 ; CHECK-NEXT: ret i32 42
614 %1 = call i32 @thunk_extern_callee()
618 define i32 @thunk_keep_callee() {
619 ; CHECK: @thunk_keep_callee() {
623 define i32 @thunk_extern_caller() fn_ret_thunk_extern {
624 ; CHECK: @thunk_extern_caller() [[FNRETTHUNK_EXTERN]]
625 ; CHECK-NEXT: ret i32 42
626 %1 = call i32 @thunk_keep_callee()
630 ; CHECK: attributes [[SLH]] = { speculative_load_hardening }
631 ; CHECK: attributes [[FPMAD_FALSE]] = { "less-precise-fpmad"="false" }
632 ; CHECK: attributes [[FPMAD_TRUE]] = { "less-precise-fpmad"="true" }
633 ; CHECK: attributes [[NOIMPLICITFLOAT]] = { noimplicitfloat }
634 ; CHECK: attributes [[NOUSEJUMPTABLES]] = { "no-jump-tables"="true" }
635 ; CHECK: attributes [[NULLPOINTERISVALID]] = { null_pointer_is_valid }
636 ; CHECK: attributes [[NO_INFS_FPMATH_FALSE]] = { "no-infs-fp-math"="false" }
637 ; CHECK: attributes [[NO_INFS_FPMATH_TRUE]] = { "no-infs-fp-math"="true" }
638 ; CHECK: attributes [[NO_NANS_FPMATH_FALSE]] = { "no-nans-fp-math"="false" }
639 ; CHECK: attributes [[NO_NANS_FPMATH_TRUE]] = { "no-nans-fp-math"="true" }
640 ; CHECK: attributes [[NO_SIGNED_ZEROS_FPMATH_FALSE]] = { "no-signed-zeros-fp-math"="false" }
641 ; CHECK: attributes [[NO_SIGNED_ZEROS_FPMATH_TRUE]] = { "no-signed-zeros-fp-math"="true" }
642 ; CHECK: attributes [[UNSAFE_FPMATH_FALSE]] = { "unsafe-fp-math"="false" }
643 ; CHECK: attributes [[UNSAFE_FPMATH_TRUE]] = { "unsafe-fp-math"="true" }
644 ; CHECK: attributes [[FNRETTHUNK_EXTERN]] = { fn_ret_thunk_extern }