1
1
//@ revisions: NO-OPT SIZE-OPT SPEED-OPT
2
- //@[NO-OPT] compile-flags: -Copt-level=0 -Ccodegen-units=1
3
- //@[SIZE-OPT] compile-flags: -Copt-level=s -Ccodegen-units=1
4
- //@[SPEED-OPT] compile-flags: -Copt-level=3 -Ccodegen-units=1
2
+ //@[NO-OPT] compile-flags: -Copt-level=0 -Zmir-opt-level=0 - Ccodegen-units=1
3
+ //@[SIZE-OPT] compile-flags: -Copt-level=s -Zmir-opt-level=0 - Ccodegen-units=1
4
+ //@[SPEED-OPT] compile-flags: -Copt-level=3 -Zmir-opt-level=0 - Ccodegen-units=1
5
5
6
6
#![ feature( optimize_attribute) ]
7
7
#![ crate_type = "rlib" ]
@@ -15,6 +15,18 @@ pub fn nothing() -> i32 {
15
15
2 + 2
16
16
}
17
17
18
+ // CHECK-LABEL: define{{.*}}i32 @none
19
+ // CHECK-SAME: [[NONE_ATTRS:#[0-9]+]]
20
+ // SIZE-OPT: call noundef i32 @callme
21
+ // SPEED-OPT: call noundef i32 @callme
22
+ #[ no_mangle]
23
+ #[ optimize( none) ]
24
+ pub fn none ( ) -> i32 {
25
+ #[ no_mangle]
26
+ fn callme ( ) -> i32 { 32 }
27
+ callme ( )
28
+ }
29
+
18
30
// CHECK-LABEL: define{{.*}}i32 @size
19
31
// CHECK-SAME: [[SIZE_ATTRS:#[0-9]+]]
20
32
// SIZE-OPT: ret i32 6
@@ -39,8 +51,10 @@ pub fn speed() -> i32 {
39
51
40
52
// NO-OPT-DAG: attributes [[SIZE_ATTRS]] = {{.*}}minsize{{.*}}optsize{{.*}}
41
53
// SPEED-OPT-DAG: attributes [[SIZE_ATTRS]] = {{.*}}minsize{{.*}}optsize{{.*}}
54
+ // SPEED-OPT-DAG: attributes [[NONE_ATTRS]] = {{.*}}optnone{{.*}}
42
55
// SIZE-OPT-DAG: attributes [[NOTHING_ATTRS]] = {{.*}}optsize{{.*}}
43
56
// SIZE-OPT-DAG: attributes [[SIZE_ATTRS]] = {{.*}}minsize{{.*}}optsize{{.*}}
57
+ // SIZE-OPT-DAG: attributes [[NONE_ATTRS]] = {{.*}}optnone{{.*}}
44
58
45
59
// SIZE-OPT: attributes [[SPEED_ATTRS]]
46
60
// SIZE-OPT-NOT: minsize
0 commit comments