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=1 -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=1 -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 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
10 ; IS__TUNIT____-LABEL: define {{[^@]+}}@foo1
11 ; IS__TUNIT____-SAME: () #[[ATTR0:[0-9]+]] {
12 ; IS__TUNIT____-NEXT: ret i32 1
14 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
15 ; IS__CGSCC____-LABEL: define {{[^@]+}}@foo1
16 ; IS__CGSCC____-SAME: () #[[ATTR0:[0-9]+]] {
17 ; IS__CGSCC____-NEXT: ret i32 1
23 define i32 @scc1_foo() {
24 ; NOT_CGSCC_NPM: Function Attrs: nofree noreturn nosync nounwind readnone willreturn
25 ; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@scc1_foo
26 ; NOT_CGSCC_NPM-SAME: () #[[ATTR1:[0-9]+]] {
27 ; NOT_CGSCC_NPM-NEXT: unreachable
29 ; IS__CGSCC_NPM: Function Attrs: nofree norecurse noreturn nosync nounwind readnone willreturn
30 ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@scc1_foo
31 ; IS__CGSCC_NPM-SAME: () #[[ATTR1:[0-9]+]] {
32 ; IS__CGSCC_NPM-NEXT: unreachable
34 %1 = call i32 @scc1_bar()
40 define i32 @scc1_bar() {
41 ; NOT_CGSCC_NPM: Function Attrs: nofree noreturn nosync nounwind readnone willreturn
42 ; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@scc1_bar
43 ; NOT_CGSCC_NPM-SAME: () #[[ATTR1]] {
44 ; NOT_CGSCC_NPM-NEXT: unreachable
46 ; IS__CGSCC_NPM: Function Attrs: nofree norecurse noreturn nosync nounwind readnone willreturn
47 ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@scc1_bar
48 ; IS__CGSCC_NPM-SAME: () #[[ATTR1]] {
49 ; IS__CGSCC_NPM-NEXT: unreachable
51 %1 = call i32 @scc1_foo()
55 declare i32 @non_nounwind()
58 define void @call_non_nounwind(){
59 ; CHECK-LABEL: define {{[^@]+}}@call_non_nounwind() {
60 ; CHECK-NEXT: [[TMP1:%.*]] = tail call i32 @non_nounwind()
61 ; CHECK-NEXT: ret void
63 tail call i32 @non_nounwind()
68 ; int maybe_throw(bool canThrow) {
75 define i32 @maybe_throw(i1 zeroext %0) {
76 ; CHECK-LABEL: define {{[^@]+}}@maybe_throw
77 ; CHECK-SAME: (i1 zeroext [[TMP0:%.*]]) {
78 ; CHECK-NEXT: br i1 [[TMP0]], label [[TMP2:%.*]], label [[TMP3:%.*]]
80 ; CHECK-NEXT: tail call void @__cxa_rethrow()
81 ; CHECK-NEXT: unreachable
83 ; CHECK-NEXT: ret i32 -1
85 br i1 %0, label %2, label %3
88 tail call void @__cxa_rethrow() #1
95 declare void @__cxa_rethrow()
100 ; int a = doThing(true);
102 ; catch(...) { return -1; }
106 define i32 @catch_thing() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
107 ; CHECK-LABEL: define {{[^@]+}}@catch_thing() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
108 ; CHECK-NEXT: invoke void @__cxa_rethrow()
109 ; CHECK-NEXT: to label [[TMP1:%.*]] unwind label [[TMP2:%.*]]
111 ; CHECK-NEXT: unreachable
113 ; CHECK-NEXT: [[TMP3:%.*]] = landingpad { i8*, i32 }
114 ; CHECK-NEXT: catch i8* null
115 ; CHECK-NEXT: [[TMP4:%.*]] = extractvalue { i8*, i32 } [[TMP3]], 0
116 ; CHECK-NEXT: [[TMP5:%.*]] = tail call i8* @__cxa_begin_catch(i8* [[TMP4]])
117 ; CHECK-NEXT: tail call void @__cxa_end_catch()
118 ; CHECK-NEXT: ret i32 -1
120 invoke void @__cxa_rethrow() #1
121 to label %1 unwind label %2
127 %3 = landingpad { i8*, i32 }
129 %4 = extractvalue { i8*, i32 } %3, 0
130 %5 = tail call i8* @__cxa_begin_catch(i8* %4) #2
131 tail call void @__cxa_end_catch()
135 define i32 @catch_thing_user() {
136 ; CHECK-LABEL: define {{[^@]+}}@catch_thing_user() {
137 ; CHECK-NEXT: [[CATCH_THING_CALL:%.*]] = call i32 @catch_thing()
138 ; CHECK-NEXT: ret i32 -1
140 %catch_thing_call = call i32 @catch_thing()
141 ret i32 %catch_thing_call
145 declare i32 @__gxx_personality_v0(...)
147 declare i8* @__cxa_begin_catch(i8*)
149 declare void @__cxa_end_catch()
151 ; IS__TUNIT____: attributes #[[ATTR0]] = { nofree nosync nounwind readnone willreturn }
152 ; IS__TUNIT____: attributes #[[ATTR1]] = { nofree noreturn nosync nounwind readnone willreturn }
154 ; IS__CGSCC_OPM: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn }
155 ; IS__CGSCC_OPM: attributes #[[ATTR1]] = { nofree noreturn nosync nounwind readnone willreturn }
157 ; IS__CGSCC_NPM: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn }
158 ; IS__CGSCC_NPM: attributes #[[ATTR1]] = { nofree norecurse noreturn nosync nounwind readnone willreturn }