aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/function-attributes.c
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-10-27 19:48:08 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-10-27 19:48:08 +0000
commit7ab1c3ebd02c31bfa1333cc51de1261c1499d6f7 (patch)
tree5ea36a558472dffb657a4390fd2b1b3614b67267 /test/CodeGen/function-attributes.c
parent0aa9424c64eb337b0d23fc60262c671b180ccd8e (diff)
Set OptimizeForSize LLVM function attribute with -Os.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85278 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/function-attributes.c')
-rw-r--r--test/CodeGen/function-attributes.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/test/CodeGen/function-attributes.c b/test/CodeGen/function-attributes.c
index 376d0b1022..b09b28b8d9 100644
--- a/test/CodeGen/function-attributes.c
+++ b/test/CodeGen/function-attributes.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm -o - %s | FileCheck %s
+// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm -Os -o - %s | FileCheck %s
// CHECK: define signext i8 @f0(i32 %x) nounwind
// CHECK: define zeroext i8 @f1(i32 %x) nounwind
// CHECK: define void @f2(i8 signext %x) nounwind
@@ -24,15 +24,22 @@ void f6(signed short x) { }
void f7(unsigned short x) { }
-// CHECK: define void @f8() nounwind alwaysinline
+// CHECK: define void @f8()
+// CHECK: nounwind
+// CHECK: alwaysinline
+// CHECK: {
void __attribute__((always_inline)) f8(void) { }
-// CHECK: call void @f9_t() noreturn
+// CHECK: call void @f9_t()
+// CHECK: noreturn
+// CHECK: {
void __attribute__((noreturn)) f9_t(void);
void f9(void) { f9_t(); }
// FIXME: We should be setting nounwind on calls.
-// CHECK: call i32 @f10_t() readnone
+// CHECK: call i32 @f10_t()
+// CHECK: readnone
+// CHECK: {
int __attribute__((const)) f10_t(void);
int f10(void) { return f10_t(); }
int f11(void) {
@@ -49,9 +56,9 @@ void f13(void){}
// Ensure that these get inlined: rdar://6853279
-// CHECK: define i32 @f14
+// CHECK: define void @f14
// CHECK-NOT: @ai_
-// CHECK: ret i32
+// CHECK: call void @f14_end
static __inline__ __attribute__((always_inline))
int ai_1() { return 4; }
@@ -60,7 +67,17 @@ struct {
int a, b, c, d, e;
} ai_2() { while (1) {} }
-int f14() {
- ai_2();
- return ai_1();
+void f14(int a) {
+ extern void f14_end(void);
+ if (a)
+ ai_2();
+ ai_1();
+ f14_end();
+}
+
+// <rdar://problem/7102668> [irgen] clang isn't setting the optsize bit on functions
+// CHECK: define void @f15
+// CHECK: optsize
+// CHECK: {
+void f15(void) {
}