1 ; RUN: opt < %s -function-attrs -S | FileCheck %s
4 ; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind readnone
5 ; CHECK-NEXT: define i32 @foo1()
11 ; CHECK: Function Attrs: nofree nosync nounwind readnone
12 ; CHECK-NEXT: define i32 @scc1_foo()
13 define i32 @scc1_foo() {
14 %1 = call i32 @scc1_bar()
20 ; CHECK: Function Attrs: nofree nosync nounwind readnone
21 ; CHECK-NEXT: define i32 @scc1_bar()
22 define i32 @scc1_bar() {
23 %1 = call i32 @scc1_foo()
27 ; CHECK: declare i32 @non_nounwind()
28 declare i32 @non_nounwind()
31 ; CHECK: define void @call_non_nounwind() {
32 define void @call_non_nounwind(){
33 tail call i32 @non_nounwind()
38 ; int maybe_throw(bool canThrow) {
45 ; CHECK: define i32 @maybe_throw(i1 zeroext %0)
46 define i32 @maybe_throw(i1 zeroext %0) {
47 br i1 %0, label %2, label %3
50 tail call void @__cxa_rethrow() #1
57 declare void @__cxa_rethrow()
62 ; int a = doThing(true);
64 ; catch(...) { return -1; }
68 ; CHECK: define i32 @catch_thing()
69 define i32 @catch_thing() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
70 invoke void @__cxa_rethrow() #1
71 to label %1 unwind label %2
77 %3 = landingpad { i8*, i32 }
79 %4 = extractvalue { i8*, i32 } %3, 0
80 %5 = tail call i8* @__cxa_begin_catch(i8* %4) #2
81 tail call void @__cxa_end_catch()
85 define i32 @catch_thing_user() {
86 %catch_thing_call = call i32 @catch_thing()
87 ret i32 %catch_thing_call
91 declare i32 @__gxx_personality_v0(...)
93 declare i8* @__cxa_begin_catch(i8*)
95 declare void @__cxa_end_catch()