File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change 1+ // revisions: NO-OPT SIZE-OPT SPEED-OPT
2+ // [NO-OPT]compile-flags: -Copt-level=0
3+ // [SIZE-OPT]compile-flags: -Copt-level=s
4+ // [SPEED-OPT]compile-flags: -Copt-level=3
5+
6+ #![ feature( optimize_attribute) ]
7+ #![ crate_type="rlib" ]
8+
9+ // NO-OPT: Function Attrs:{{.*}}optnone
10+ // NO-OPT-NOT: {{optsize|minsize}}
11+ // NO-OPT-NEXT: @nothing
12+ // NO-OPT: ret i32 %1
13+ //
14+ // SIZE-OPT: Function Attrs:{{.*}}optsize
15+ // SIZE-OPT-NOT: {{minsize|optnone}}
16+ // SIZE-OPT-NEXT: @nothing
17+ // SIZE-OPT-NEXT: start
18+ // SIZE-OPT-NEXT: ret i32 4
19+ //
20+ // SPEED-OPT: Function Attrs:
21+ // SPEED-OPT-NOT: {{minsize|optnone|optsize}}
22+ // SPEED-OPT-NEXT: @nothing
23+ // SPEED-OPT-NEXT: start
24+ // SPEED-OPT-NEXT: ret i32 4
25+ #[ no_mangle]
26+ pub fn nothing ( ) -> i32 {
27+ 2 + 2
28+ }
29+
30+ // CHECK: Function Attrs:{{.*}} minsize{{.*}}optsize
31+ // CHECK-NEXT: @size
32+ // CHECK-NEXT: start
33+ // CHECK-NEXT: ret i32 4
34+ #[ optimize( size) ]
35+ #[ no_mangle]
36+ pub fn size ( ) -> i32 {
37+ 2 + 2
38+ }
39+
40+ // CHECK: Function Attrs:
41+ // CHECK-NOT: {{minsize|optsize|optnone}}
42+ // CHECK-NEXT: @speed
43+ // CHECK-NEXT: start
44+ // CHECK-NEXT: ret i32 4
45+ #[ optimize( speed) ]
46+ #[ no_mangle]
47+ pub fn speed ( ) -> i32 {
48+ 2 + 2
49+ }
You can’t perform that action at this time.
0 commit comments