2015-11-14 09:10:38 +08:00
|
|
|
// RUN: %clang_cc1 -Oz -disable-llvm-optzns -emit-llvm %s -o - | FileCheck %s -check-prefix=Oz
|
|
|
|
// RUN: %clang_cc1 -disable-llvm-optzns -emit-llvm %s -o - | FileCheck %s -check-prefix=OTHER
|
|
|
|
// RUN: %clang_cc1 -O1 -disable-llvm-optzns -emit-llvm %s -o - | FileCheck %s -check-prefix=OTHER
|
|
|
|
// RUN: %clang_cc1 -O2 -disable-llvm-optzns -emit-llvm %s -o - | FileCheck %s -check-prefix=OTHER
|
|
|
|
// RUN: %clang_cc1 -O3 -disable-llvm-optzns -emit-llvm %s -o - | FileCheck %s -check-prefix=OTHER
|
|
|
|
// RUN: %clang_cc1 -Os -disable-llvm-optzns -emit-llvm %s -o - | FileCheck %s -check-prefix=OTHER
|
2012-11-02 07:55:47 +08:00
|
|
|
// Check that we set the minsize attribute on each function
|
|
|
|
// when Oz optimization level is set.
|
|
|
|
|
2013-02-21 03:30:01 +08:00
|
|
|
__attribute__((minsize))
|
2012-11-02 07:55:47 +08:00
|
|
|
int test1() {
|
|
|
|
return 42;
|
2013-02-21 03:30:01 +08:00
|
|
|
// Oz: @{{.*}}test1{{.*}}[[MINSIZE:#[0-9]+]]
|
|
|
|
// OTHER: @{{.*}}test1{{.*}}[[MS:#[0-9]+]]
|
2012-11-02 07:55:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int test2() {
|
|
|
|
return 42;
|
2013-02-21 03:30:01 +08:00
|
|
|
// Oz: @{{.*}}test2{{.*}}[[MINSIZE]]
|
2012-11-02 07:55:47 +08:00
|
|
|
// Oz: ret
|
|
|
|
// OTHER: @{{.*}}test2
|
2013-02-21 03:30:01 +08:00
|
|
|
// OTHER-NOT: [[MS]]
|
2012-11-02 07:55:47 +08:00
|
|
|
// OTHER: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
int test3() {
|
|
|
|
return 42;
|
2013-02-21 03:30:01 +08:00
|
|
|
// Oz: @{{.*}}test3{{.*}}[[MINSIZE]]
|
|
|
|
// Oz: ret
|
|
|
|
// OTHER: @{{.*}}test3
|
|
|
|
// OTHER-NOT: [[MS]]
|
|
|
|
// OTHER: ret
|
2012-11-02 07:55:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Check that the minsize attribute is well propagated through
|
|
|
|
// template instantiation
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
__attribute__((minsize))
|
|
|
|
void test4(T arg) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
template
|
|
|
|
void test4<int>(int arg);
|
|
|
|
// Oz: define{{.*}}void @{{.*}}test4
|
2013-02-21 03:30:01 +08:00
|
|
|
// Oz: [[MINSIZE]]
|
2012-11-02 07:55:47 +08:00
|
|
|
// OTHER: define{{.*}}void @{{.*}}test4
|
2013-02-21 03:30:01 +08:00
|
|
|
// OTHER: [[MS]]
|
2012-11-02 07:55:47 +08:00
|
|
|
|
|
|
|
template
|
|
|
|
void test4<float>(float arg);
|
|
|
|
// Oz: define{{.*}}void @{{.*}}test4
|
2013-02-21 03:30:01 +08:00
|
|
|
// Oz: [[MINSIZE]]
|
2012-11-02 07:55:47 +08:00
|
|
|
// OTHER: define{{.*}}void @{{.*}}test4
|
2013-02-21 03:30:01 +08:00
|
|
|
// OTHER: [[MS]]
|
2012-11-02 07:55:47 +08:00
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
void test5(T arg) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
template
|
|
|
|
void test5<int>(int arg);
|
|
|
|
// Oz: define{{.*}}void @{{.*}}test5
|
2013-02-21 03:30:01 +08:00
|
|
|
// Oz: [[MINSIZE]]
|
2012-11-02 07:55:47 +08:00
|
|
|
// OTHER: define{{.*}}void @{{.*}}test5
|
2013-02-21 03:30:01 +08:00
|
|
|
// OTHER-NOT: define{{.*}}void @{{.*}}test5{{.*}}[[MS]]
|
2012-11-02 07:55:47 +08:00
|
|
|
|
|
|
|
template
|
|
|
|
void test5<float>(float arg);
|
|
|
|
// Oz: define{{.*}}void @{{.*}}test5
|
2013-02-21 03:30:01 +08:00
|
|
|
// Oz: [[MINSIZE]]
|
2012-11-02 07:55:47 +08:00
|
|
|
// OTHER: define{{.*}}void @{{.*}}test5
|
2013-02-21 03:30:01 +08:00
|
|
|
// OTHER-NOT: define{{.*}}void @{{.*}}test5{{.*}}[[MS]]
|
2013-02-20 15:22:19 +08:00
|
|
|
|
2013-02-21 03:30:01 +08:00
|
|
|
// Oz: attributes [[MINSIZE]] = { minsize{{.*}} }
|
2013-02-20 15:22:19 +08:00
|
|
|
|
2015-11-14 09:10:38 +08:00
|
|
|
// OTHER: attributes [[MS]] = { minsize nounwind{{.*}} }
|