1 ; RUN: llvm-as < %s | llvm-dis | FileCheck %s --check-prefixes=CHECK,CHECK-TYPED
2 ; RUN: llvm-as -opaque-pointers < %s | llvm-dis -opaque-pointers | FileCheck %s --check-prefixes=CHECK,CHECK-OPAQUE
3 ; RUN: verify-uselistorder < %s
6 define void @f1(i8 zeroext %0)
7 ; CHECK: define void @f1(i8 zeroext %0)
12 define void @f2(i8 signext %0)
13 ; CHECK: define void @f2(i8 signext %0)
18 define void @f3() noreturn
19 ; CHECK: define void @f3() #0
24 define void @f4(i8 inreg %0)
25 ; CHECK: define void @f4(i8 inreg %0)
30 define void @f5(i8* sret(i8) %0)
31 ; CHECK-TYPED: define void @f5(i8* sret(i8) %0)
32 ; CHECK-OPAQUE: define void @f5(ptr sret(i8) %0)
37 define void @f6() nounwind
38 ; CHECK: define void @f6() #1
43 define void @f7(i8* noalias %0)
44 ; CHECK-TYPED: define void @f7(i8* noalias %0)
45 ; CHECK-OPAQUE: define void @f7(ptr noalias %0)
50 define void @f8(i8* byval(i8) %0)
51 ; CHECK-TYPED: define void @f8(i8* byval(i8) %0)
52 ; CHECK-OPAQUE: define void @f8(ptr byval(i8) %0)
57 define void @f9(i8* nest %0)
58 ; CHECK-TYPED: define void @f9(i8* nest %0)
59 ; CHECK-OPAQUE: define void @f9(ptr nest %0)
64 define void @f10() readnone
65 ; CHECK: define void @f10() #2
70 define void @f11() readonly
71 ; CHECK: define void @f11() #3
76 define void @f12() noinline
77 ; CHECK: define void @f12() #4
82 define void @f13() alwaysinline
83 ; CHECK: define void @f13() #5
88 define void @f14() optsize
89 ; CHECK: define void @f14() #6
94 define void @f15() ssp
95 ; CHECK: define void @f15() #7
100 define void @f16() sspreq
101 ; CHECK: define void @f16() #8
106 define void @f17(i8* align 4 %0)
107 ; CHECK-TYPED: define void @f17(i8* align 4 %0)
108 ; CHECK-OPAQUE: define void @f17(ptr align 4 %0)
113 define void @f18(i8* nocapture %0)
114 ; CHECK-TYPED: define void @f18(i8* nocapture %0)
115 ; CHECK-OPAQUE: define void @f18(ptr nocapture %0)
120 define void @f19() noredzone
121 ; CHECK: define void @f19() #9
126 define void @f20() noimplicitfloat
127 ; CHECK: define void @f20() #10
132 define void @f21() naked
133 ; CHECK: define void @f21() #11
138 define void @f22() inlinehint
139 ; CHECK: define void @f22() #12
144 define void @f23() alignstack(4)
145 ; CHECK: define void @f23() #13
150 define void @f24() returns_twice
151 ; CHECK: define void @f24() #14
156 define void @f25() uwtable
157 ; CHECK: define void @f25() #15
162 define void @f26() nonlazybind
163 ; CHECK: define void @f26() #16
168 define void @f27() sanitize_address
169 ; CHECK: define void @f27() #17
173 define void @f28() sanitize_thread
174 ; CHECK: define void @f28() #18
178 define void @f29() sanitize_memory
179 ; CHECK: define void @f29() #19
184 define void @f30() "cpu"="cortex-a8"
185 ; CHECK: define void @f30() #20
190 define i8 @f31(i8 returned %A)
191 ; CHECK: define i8 @f31(i8 returned %A)
196 define void @f32() sspstrong
197 ; CHECK: define void @f32() #21
202 define void @f33() minsize
203 ; CHECK: define void @f33() #22
208 declare void @nobuiltin()
211 ; CHECK: define void @f34()
213 call void @nobuiltin() nobuiltin
214 ; CHECK: call void @nobuiltin() #[[NOBUILTIN:[0-9]+]]
218 define void @f35() optnone noinline
219 ; CHECK: define void @f35() #23
224 define void @f36(i8* inalloca(i8) %0) {
225 ; CHECK-TYPED: define void @f36(i8* inalloca(i8) %0) {
226 ; CHECK-OPAQUE: define void @f36(ptr inalloca(i8) %0) {
230 define nonnull i8* @f37(i8* nonnull %a) {
231 ; CHECK-TYPED: define nonnull i8* @f37(i8* nonnull %a) {
232 ; CHECK-OPAQUE: define nonnull ptr @f37(ptr nonnull %a) {
236 define void @f38() unnamed_addr jumptable {
237 ; CHECK: define void @f38() unnamed_addr #24
238 call void bitcast (void (i8*)* @f36 to void ()*)()
242 define dereferenceable(2) i8* @f39(i8* dereferenceable(1) %a) {
243 ; CHECK-TYPED: define dereferenceable(2) i8* @f39(i8* dereferenceable(1) %a) {
244 ; CHECK-OPAQUE: define dereferenceable(2) ptr @f39(ptr dereferenceable(1) %a) {
248 define dereferenceable(18446744073709551606) i8* @f40(i8* dereferenceable(18446744073709551615) %a) {
249 ; CHECK-TYPED: define dereferenceable(18446744073709551606) i8* @f40(i8* dereferenceable(18446744073709551615) %a) {
250 ; CHECK-OPAQUE: define dereferenceable(18446744073709551606) ptr @f40(ptr dereferenceable(18446744073709551615) %a) {
254 define void @f41(i8* align 32 %0, double* align 64 %1) {
255 ; CHECK-TYPED: define void @f41(i8* align 32 %0, double* align 64 %1) {
256 ; CHECK-OPAQUE: define void @f41(ptr align 32 %0, ptr align 64 %1) {
260 ; CHECK-TYPED: define dereferenceable_or_null(8) i8* @f42(i8* dereferenceable_or_null(8) %foo)
261 ; CHECK-OPAQUE: define dereferenceable_or_null(8) ptr @f42(ptr dereferenceable_or_null(8) %foo)
262 define dereferenceable_or_null(8) i8* @f42(i8* dereferenceable_or_null(8) %foo) {
267 ; CHECK: define void @f43() #25
268 define void @f43() convergent {
272 define void @f44() argmemonly
273 ; CHECK: define void @f44() #26
278 ; CHECK: define "string_attribute" void @f45(i32 "string_attribute" %0)
279 define "string_attribute" void @f45(i32 "string_attribute" %0) {
283 ; CHECK: define "string_attribute_with_value"="value" void @f46(i32 "string_attribute_with_value"="value" %0)
284 define "string_attribute_with_value"="value" void @f46(i32 "string_attribute_with_value"="value" %0) {
288 ; CHECK: define void @f47() #27
289 define void @f47() norecurse {
293 ; CHECK: define void @f48() #28
294 define void @f48() inaccessiblememonly {
298 ; CHECK: define void @f49() #29
299 define void @f49() inaccessiblemem_or_argmemonly {
303 ; CHECK-TYPED: define void @f50(i8* swiftself %0)
304 ; CHECK-OPAQUE: define void @f50(ptr swiftself %0)
305 define void @f50(i8* swiftself %0)
310 ; CHECK-TYPED: define i32 @f51(i8** swifterror %0)
311 ; CHECK-OPAQUE: define i32 @f51(ptr swifterror %0)
312 define i32 @f51(i8** swifterror %0)
317 ; CHECK-TYPED: define i32 @f52(i32 %0, i8** swifterror %1)
318 ; CHECK-OPAQUE: define i32 @f52(i32 %0, ptr swifterror %1)
319 define i32 @f52(i32 %0, i8** swifterror %1)
324 %swift_error = type {i64, i8}
325 declare float @foo(%swift_error** swifterror %error_ptr_ref)
327 ; CHECK: define float @f53
328 ; CHECK: alloca swifterror
329 define float @f53(i8* %error_ref) {
331 %error_ptr_ref = alloca swifterror %swift_error*
332 store %swift_error* null, %swift_error** %error_ptr_ref
333 %call = call float @foo(%swift_error** swifterror %error_ptr_ref)
337 ; CHECK-TYPED: define i8* @f54(i32 %0) #30
338 ; CHECK-OPAQUE: define ptr @f54(i32 %0) #30
339 define i8* @f54(i32 %0) allocsize(0) {
343 ; CHECK-TYPED: define i8* @f55(i32 %0, i32 %1) #31
344 ; CHECK-OPAQUE: define ptr @f55(i32 %0, i32 %1) #31
345 define i8* @f55(i32 %0, i32 %1) allocsize(0, 1) {
349 ; CHECK: define void @f56() #32
350 define void @f56() writeonly
355 ; CHECK: define void @f57() #33
356 define void @f57() speculatable {
360 ; CHECK: define void @f58() #34
361 define void @f58() sanitize_hwaddress
366 ; CHECK: define void @f59() #35
367 define void @f59() shadowcallstack
372 ; CHECK: define void @f60() #36
373 define void @f60() willreturn
378 ; CHECK: define void @f61() #37
379 define void @f61() nofree {
383 ; CHECK: define void @f62() #38
384 define void @f62() nosync
389 ; CHECK: define void @f63() #39
390 define void @f63() sanitize_memtag
395 ; CHECK-TYPED: define void @f64(i32* preallocated(i32) %a)
396 ; CHECK-OPAQUE: define void @f64(ptr preallocated(i32) %a)
397 define void @f64(i32* preallocated(i32) %a)
402 ; CHECK: define void @f65() #40
403 define void @f65() null_pointer_is_valid
408 ; CHECK: define noundef i32 @f66(i32 noundef %a)
409 define noundef i32 @f66(i32 noundef %a)
414 ; CHECK-TYPED: define void @f67(i32* byref(i32) %a)
415 ; CHECK-OPAQUE: define void @f67(ptr byref(i32) %a)
416 define void @f67(i32* byref(i32) %a)
421 ; CHECK: define void @f68() #41
422 define void @f68() mustprogress
427 ; CHECK: define void @f69() #42
428 define void @f69() nocallback
433 ; CHECK: define void @f70() #43
434 define void @f70() cold
439 ; CHECK: define void @f71() #44
440 define void @f71() hot
445 ; CHECK: define void @f72() #45
446 define void @f72() vscale_range(8)
451 ; CHECK: define void @f73() #46
452 define void @f73() vscale_range(1,8)
457 ; CHECK: define void @f74() #47
458 define void @f74() vscale_range(1,0)
463 ; CHECK-TYPED: define void @f76(i8* swiftasync %0)
464 ; CHECK-OPAQUE: define void @f76(ptr swiftasync %0)
465 define void @f76(i8* swiftasync %0)
470 ; CHECK: define void @f77() #48
471 define void @f77() nosanitize_coverage
476 ; CHECK: define void @f78() #49
477 define void @f78() noprofile
482 declare void @llvm.some.intrinsic(i32*)
484 ; CHECK-TYPED: call void @llvm.some.intrinsic(i32* elementtype(i32) null)
485 ; CHECK-OPAQUE: call void @llvm.some.intrinsic(ptr elementtype(i32) null)
486 call void @llvm.some.intrinsic(i32* elementtype(i32) null)
490 ; CHECK: define void @f80() #50
491 define void @f80() disable_sanitizer_instrumentation
496 define void @f81(i8** sret(i8*) %0)
497 ; CHECK-TYPED: define void @f81(i8** sret(i8*) %0)
498 ; CHECK-OPAQUE: define void @f81(ptr sret(ptr) %0)
503 define void @f82(i32* %0)
504 ; CHECK-TYPED: define void @f82(i32* %0)
505 ; CHECK-OPAQUE: define void @f82(ptr %0)
507 ; CHECK-TYPED: call void @llvm.some.intrinsic(i32* sret(i32) %0)
508 ; CHECK-OPAQUE: call void @llvm.some.intrinsic(ptr sret(i32) %0)
509 call void @llvm.some.intrinsic(i32* sret(i32) %0)
513 ; CHECK-TYPED: define void @f83(<4 x i8*> align 32 %0, <vscale x 1 x double*> align 64 %1)
514 ; CHECK-OPQUE: define void @f83(<4 x ptr> align 32 %0, <vscale x 1 x ptr> align 64 %1)
515 define void @f83(<4 x i8*> align 32 %0, <vscale x 1 x double*> align 64 %1) {
519 ; CHECK: define void @f84() #51
520 define void @f84() uwtable(sync) {
524 ; CHECK: define void @f85() #15
525 define void @f85() uwtable(async) {
529 ; CHECK: define void @f86() #52
530 define void @f86() nosanitize_bounds
535 ; CHECK: define void @f87() [[FNRETTHUNKEXTERN:#[0-9]+]]
536 define void @f87() fn_ret_thunk_extern { ret void }
538 ; CHECK: define void @f88() [[SKIPPROFILE:#[0-9]+]]
539 define void @f88() skipprofile { ret void }
541 ; CHECK: attributes #0 = { noreturn }
542 ; CHECK: attributes #1 = { nounwind }
543 ; CHECK: attributes #2 = { readnone }
544 ; CHECK: attributes #3 = { readonly }
545 ; CHECK: attributes #4 = { noinline }
546 ; CHECK: attributes #5 = { alwaysinline }
547 ; CHECK: attributes #6 = { optsize }
548 ; CHECK: attributes #7 = { ssp }
549 ; CHECK: attributes #8 = { sspreq }
550 ; CHECK: attributes #9 = { noredzone }
551 ; CHECK: attributes #10 = { noimplicitfloat }
552 ; CHECK: attributes #11 = { naked }
553 ; CHECK: attributes #12 = { inlinehint }
554 ; CHECK: attributes #13 = { alignstack=4 }
555 ; CHECK: attributes #14 = { returns_twice }
556 ; CHECK: attributes #15 = { uwtable }
557 ; CHECK: attributes #16 = { nonlazybind }
558 ; CHECK: attributes #17 = { sanitize_address }
559 ; CHECK: attributes #18 = { sanitize_thread }
560 ; CHECK: attributes #19 = { sanitize_memory }
561 ; CHECK: attributes #20 = { "cpu"="cortex-a8" }
562 ; CHECK: attributes #21 = { sspstrong }
563 ; CHECK: attributes #22 = { minsize }
564 ; CHECK: attributes #23 = { noinline optnone }
565 ; CHECK: attributes #24 = { jumptable }
566 ; CHECK: attributes #25 = { convergent }
567 ; CHECK: attributes #26 = { argmemonly }
568 ; CHECK: attributes #27 = { norecurse }
569 ; CHECK: attributes #28 = { inaccessiblememonly }
570 ; CHECK: attributes #29 = { inaccessiblemem_or_argmemonly }
571 ; CHECK: attributes #30 = { allocsize(0) }
572 ; CHECK: attributes #31 = { allocsize(0,1) }
573 ; CHECK: attributes #32 = { writeonly }
574 ; CHECK: attributes #33 = { speculatable }
575 ; CHECK: attributes #34 = { sanitize_hwaddress }
576 ; CHECK: attributes #35 = { shadowcallstack }
577 ; CHECK: attributes #36 = { willreturn }
578 ; CHECK: attributes #37 = { nofree }
579 ; CHECK: attributes #38 = { nosync }
580 ; CHECK: attributes #39 = { sanitize_memtag }
581 ; CHECK: attributes #40 = { null_pointer_is_valid }
582 ; CHECK: attributes #41 = { mustprogress }
583 ; CHECK: attributes #42 = { nocallback }
584 ; CHECK: attributes #43 = { cold }
585 ; CHECK: attributes #44 = { hot }
586 ; CHECK: attributes #45 = { vscale_range(8,8) }
587 ; CHECK: attributes #46 = { vscale_range(1,8) }
588 ; CHECK: attributes #47 = { vscale_range(1,0) }
589 ; CHECK: attributes #48 = { nosanitize_coverage }
590 ; CHECK: attributes #49 = { noprofile }
591 ; CHECK: attributes #50 = { disable_sanitizer_instrumentation }
592 ; CHECK: attributes #51 = { uwtable(sync) }
593 ; CHECK: attributes #52 = { nosanitize_bounds }
594 ; CHECK: attributes [[FNRETTHUNKEXTERN]] = { fn_ret_thunk_extern }
595 ; CHECK: attributes [[SKIPPROFILE]] = { skipprofile }
596 ; CHECK: attributes #[[NOBUILTIN]] = { nobuiltin }