blob: a422a62f2535ab51ee7515bb644b1c64b874dc88 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
// RUN: %clang_cc1 -Oz -emit-llvm %s -o - | FileCheck %s -check-prefix=Oz
// RUN: %clang_cc1 -O0 -emit-llvm %s -o - | FileCheck %s -check-prefix=OTHER
// RUN: %clang_cc1 -O1 -emit-llvm %s -o - | FileCheck %s -check-prefix=OTHER
// RUN: %clang_cc1 -O2 -emit-llvm %s -o - | FileCheck %s -check-prefix=OTHER
// RUN: %clang_cc1 -O3 -emit-llvm %s -o - | FileCheck %s -check-prefix=OTHER
// RUN: %clang_cc1 -Os -emit-llvm %s -o - | FileCheck %s -check-prefix=OTHER
// Check that we set the minsize attribute on each function
// when Oz optimization level is set.
int test1() {
return 42;
// Oz: @{{.*}}test1{{.*}}minsize
// Oz: ret
// OTHER: @{{.*}}test1
// OTHER-NOT: minsize
// OTHER: ret
}
int test2() {
return 42;
// Oz: @{{.*}}test2{{.*}}minsize
// Oz: ret
// OTHER: @{{.*}}test2
// OTHER-NOT: minsize
// OTHER: ret
}
__attribute__((minsize))
int test3() {
return 42;
// Oz: @{{.*}}test3{{.*}}minsize
// OTHER: @{{.*}}test3{{.*}}minsize
}
// 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
// Oz: minsize
// OTHER: define{{.*}}void @{{.*}}test4
// OTHER: minsize
template
void test4<float>(float arg);
// Oz: define{{.*}}void @{{.*}}test4
// Oz: minsize
// OTHER: define{{.*}}void @{{.*}}test4
// OTHER: minsize
template<typename T>
void test5(T arg) {
return;
}
template
void test5<int>(int arg);
// Oz: define{{.*}}void @{{.*}}test5
// Oz: minsize
// OTHER: define{{.*}}void @{{.*}}test5
// OTHER-NOT: minsize
template
void test5<float>(float arg);
// Oz: define{{.*}}void @{{.*}}test5
// Oz: minsize
// OTHER: define{{.*}}void @{{.*}}test5
// OTHER-NOT: minsize
|