1 // RUN: clang-cc -triple i386-unknown-unknown -emit-llvm -o %t %s &&
2 // RUN: grep 'define signext i8 @f0(i32 %x) nounwind' %t &&
3 // RUN: grep 'define zeroext i8 @f1(i32 %x) nounwind' %t &&
4 // RUN: grep 'define void @f2(i8 signext %x) nounwind' %t &&
5 // RUN: grep 'define void @f3(i8 zeroext %x) nounwind' %t &&
6 // RUN: grep 'define signext i16 @f4(i32 %x) nounwind' %t &&
7 // RUN: grep 'define zeroext i16 @f5(i32 %x) nounwind' %t &&
8 // RUN: grep 'define void @f6(i16 signext %x) nounwind' %t &&
9 // RUN: grep 'define void @f7(i16 zeroext %x) nounwind' %t &&
11 signed char f0(int x
) { return x
; }
13 unsigned char f1(int x
) { return x
; }
15 void f2(signed char x
) { }
17 void f3(unsigned char x
) { }
19 signed short f4(int x
) { return x
; }
21 unsigned short f5(int x
) { return x
; }
23 void f6(signed short x
) { }
25 void f7(unsigned short x
) { }
27 // RUN: grep 'define void @f8() nounwind alwaysinline' %t &&
28 void __attribute__((always_inline
)) f8(void) { }
30 // RUN: grep 'call void @f9_t() noreturn' %t &&
31 void __attribute__((noreturn
)) f9_t(void);
32 void f9(void) { f9_t(); }
34 // FIXME: We should be setting nounwind on calls.
35 // RUN: grep 'call i32 @f10_t() readnone' %t &&
36 int __attribute__((const)) f10_t(void);
37 int f10(void) { return f10_t(); }
43 return arg
? 0 : f10_t();
46 // RUN: grep 'define void @f13() nounwind readnone' %t &&
47 void f13(void) __attribute__((pure
)) __attribute__((const));
51 // Ensure that these get inlined: rdar://6853279
52 // RUN: not grep '@ai_' %t &&
53 static __inline__
__attribute__((always_inline
))
54 int ai_1() { return 4; }
56 static __inline__
__attribute__((always_inline
))