1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
2 ; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=4 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
3 ; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=4 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
4 ; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM
5 ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM
9 ; Inlining should nuke the invoke (and any inlined calls) here even with
10 ; argument promotion running along with it.
11 define void @zot() personality i32 (...)* @wibble {
12 ; IS__TUNIT____: Function Attrs: nofree noreturn nosync nounwind readnone willreturn
13 ; IS__TUNIT____-LABEL: define {{[^@]+}}@zot
14 ; IS__TUNIT____-SAME: () #[[ATTR0:[0-9]+]] personality i32 (...)* @wibble {
15 ; IS__TUNIT____-NEXT: bb:
16 ; IS__TUNIT____-NEXT: call void @hoge() #[[ATTR1:[0-9]+]]
17 ; IS__TUNIT____-NEXT: unreachable
19 ; IS__TUNIT____-NEXT: unreachable
21 ; IS__TUNIT____-NEXT: unreachable
23 ; IS__CGSCC____: Function Attrs: nofree norecurse noreturn nosync nounwind readnone willreturn
24 ; IS__CGSCC____-LABEL: define {{[^@]+}}@zot
25 ; IS__CGSCC____-SAME: () #[[ATTR0:[0-9]+]] personality i32 (...)* @wibble {
26 ; IS__CGSCC____-NEXT: bb:
27 ; IS__CGSCC____-NEXT: call void @hoge() #[[ATTR2:[0-9]+]]
28 ; IS__CGSCC____-NEXT: unreachable
30 ; IS__CGSCC____-NEXT: unreachable
32 ; IS__CGSCC____-NEXT: unreachable
36 to label %bb1 unwind label %bb2
42 %tmp = landingpad { i8*, i32 }
47 define internal void @hoge() {
48 ; IS__TUNIT____: Function Attrs: nofree noreturn nosync nounwind readnone willreturn
49 ; IS__TUNIT____-LABEL: define {{[^@]+}}@hoge
50 ; IS__TUNIT____-SAME: () #[[ATTR0]] {
51 ; IS__TUNIT____-NEXT: bb:
52 ; IS__TUNIT____-NEXT: unreachable
54 ; IS__CGSCC____: Function Attrs: nofree norecurse noreturn nosync nounwind readnone willreturn
55 ; IS__CGSCC____-LABEL: define {{[^@]+}}@hoge
56 ; IS__CGSCC____-SAME: () #[[ATTR0]] {
57 ; IS__CGSCC____-NEXT: bb:
58 ; IS__CGSCC____-NEXT: unreachable
61 %tmp = call fastcc i8* @spam(i1 (i8*)* @eggs)
62 %tmp1 = call fastcc i8* @spam(i1 (i8*)* @barney)
66 define internal fastcc i8* @spam(i1 (i8*)* %arg) {
67 ; IS__CGSCC____: Function Attrs: nofree norecurse noreturn nosync nounwind readnone willreturn
68 ; IS__CGSCC____-LABEL: define {{[^@]+}}@spam
69 ; IS__CGSCC____-SAME: () #[[ATTR0]] {
70 ; IS__CGSCC____-NEXT: bb:
71 ; IS__CGSCC____-NEXT: unreachable
77 define internal i1 @eggs(i8* %arg) {
78 ; IS__CGSCC____-LABEL: define {{[^@]+}}@eggs
79 ; IS__CGSCC____-SAME: (i8* [[ARG:%.*]]) {
80 ; IS__CGSCC____-NEXT: bb:
81 ; IS__CGSCC____-NEXT: [[TMP:%.*]] = call zeroext i1 @barney()
82 ; IS__CGSCC____-NEXT: unreachable
85 %tmp = call zeroext i1 @barney(i8* %arg)
89 define internal i1 @barney(i8* %arg) {
90 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
91 ; IS__CGSCC____-LABEL: define {{[^@]+}}@barney
92 ; IS__CGSCC____-SAME: () #[[ATTR1:[0-9]+]] {
93 ; IS__CGSCC____-NEXT: bb:
94 ; IS__CGSCC____-NEXT: ret i1 undef
100 define i32 @test_inf_promote_caller(i32 %arg) {
101 ; IS__TUNIT____: Function Attrs: nofree noreturn nosync nounwind readnone willreturn
102 ; IS__TUNIT____-LABEL: define {{[^@]+}}@test_inf_promote_caller
103 ; IS__TUNIT____-SAME: (i32 [[ARG:%.*]]) #[[ATTR0]] {
104 ; IS__TUNIT____-NEXT: bb:
105 ; IS__TUNIT____-NEXT: unreachable
107 ; IS__CGSCC____: Function Attrs: nofree norecurse noreturn nosync nounwind readnone willreturn
108 ; IS__CGSCC____-LABEL: define {{[^@]+}}@test_inf_promote_caller
109 ; IS__CGSCC____-SAME: (i32 [[ARG:%.*]]) #[[ATTR0]] {
110 ; IS__CGSCC____-NEXT: bb:
111 ; IS__CGSCC____-NEXT: [[TMP:%.*]] = alloca [[S:%.*]], align 8
112 ; IS__CGSCC____-NEXT: [[TMP1:%.*]] = alloca [[S]], align 8
113 ; IS__CGSCC____-NEXT: unreachable
118 %tmp2 = call i32 @test_inf_promote_callee(%S* %tmp, %S* %tmp1)
123 define internal i32 @test_inf_promote_callee(%S* %arg, %S* %arg1) {
124 ; IS__CGSCC____: Function Attrs: nofree norecurse noreturn nosync nounwind readnone willreturn
125 ; IS__CGSCC____-LABEL: define {{[^@]+}}@test_inf_promote_callee
126 ; IS__CGSCC____-SAME: () #[[ATTR0]] {
127 ; IS__CGSCC____-NEXT: bb:
128 ; IS__CGSCC____-NEXT: unreachable
131 %tmp = getelementptr %S, %S* %arg1, i32 0, i32 0
132 %tmp2 = load %S*, %S** %tmp
133 %tmp3 = getelementptr %S, %S* %arg, i32 0, i32 0
134 %tmp4 = load %S*, %S** %tmp3
135 %tmp5 = call i32 @test_inf_promote_callee(%S* %tmp4, %S* %tmp2)
140 declare i32 @wibble(...)
142 ; IS__TUNIT____: attributes #[[ATTR0]] = { nofree noreturn nosync nounwind readnone willreturn }
143 ; IS__TUNIT____: attributes #[[ATTR1]] = { noreturn nounwind readnone }
145 ; IS__CGSCC____: attributes #[[ATTR0]] = { nofree norecurse noreturn nosync nounwind readnone willreturn }
146 ; IS__CGSCC____: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind readnone willreturn }
147 ; IS__CGSCC____: attributes #[[ATTR2]] = { noreturn nounwind readnone }