xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/2009-05-04-PureConstNounwind.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple i386-unknown-unknown -fexceptions -emit-llvm %s -o - | FileCheck %s
2*f4a2713aSLionel Sambuc int c(void) __attribute__((const));
3*f4a2713aSLionel Sambuc int p(void) __attribute__((pure));
4*f4a2713aSLionel Sambuc int t(void);
5*f4a2713aSLionel Sambuc 
6*f4a2713aSLionel Sambuc // CHECK: define i32 @_Z1fv() [[TF:#[0-9]+]] {
f(void)7*f4a2713aSLionel Sambuc int f(void) {
8*f4a2713aSLionel Sambuc   // CHECK: call i32 @_Z1cv() [[NUW_RN_CALL:#[0-9]+]]
9*f4a2713aSLionel Sambuc   // CHECK: call i32 @_Z1pv() [[NUW_RO_CALL:#[0-9]+]]
10*f4a2713aSLionel Sambuc   return c() + p() + t();
11*f4a2713aSLionel Sambuc }
12*f4a2713aSLionel Sambuc 
13*f4a2713aSLionel Sambuc // CHECK: declare i32 @_Z1cv() [[NUW_RN:#[0-9]+]]
14*f4a2713aSLionel Sambuc // CHECK: declare i32 @_Z1pv() [[NUW_RO:#[0-9]+]]
15*f4a2713aSLionel Sambuc // CHECK: declare i32 @_Z1tv() [[TF]]
16*f4a2713aSLionel Sambuc 
17*f4a2713aSLionel Sambuc // CHECK: attributes [[TF]] = { {{.*}} }
18*f4a2713aSLionel Sambuc // CHECK: attributes [[NUW_RN]] = { nounwind readnone{{.*}} }
19*f4a2713aSLionel Sambuc // CHECK: attributes [[NUW_RO]] = { nounwind readonly{{.*}} }
20*f4a2713aSLionel Sambuc // CHECK: attributes [[NUW_RN_CALL]] = { nounwind readnone }
21*f4a2713aSLionel Sambuc // CHECK: attributes [[NUW_RO_CALL]] = { nounwind readonly }
22