11//@ 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
55
66#![ feature( optimize_attribute) ]
77#![ crate_type = "rlib" ]
@@ -15,6 +15,18 @@ pub fn nothing() -> i32 {
1515 2 + 2
1616}
1717
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+
1830// CHECK-LABEL: define{{.*}}i32 @size
1931// CHECK-SAME: [[SIZE_ATTRS:#[0-9]+]]
2032// SIZE-OPT: ret i32 6
@@ -39,8 +51,10 @@ pub fn speed() -> i32 {
3951
4052// NO-OPT-DAG: attributes [[SIZE_ATTRS]] = {{.*}}minsize{{.*}}optsize{{.*}}
4153// SPEED-OPT-DAG: attributes [[SIZE_ATTRS]] = {{.*}}minsize{{.*}}optsize{{.*}}
54+ // SPEED-OPT-DAG: attributes [[NONE_ATTRS]] = {{.*}}optnone{{.*}}
4255// SIZE-OPT-DAG: attributes [[NOTHING_ATTRS]] = {{.*}}optsize{{.*}}
4356// SIZE-OPT-DAG: attributes [[SIZE_ATTRS]] = {{.*}}minsize{{.*}}optsize{{.*}}
57+ // SIZE-OPT-DAG: attributes [[NONE_ATTRS]] = {{.*}}optnone{{.*}}
4458
4559// SIZE-OPT: attributes [[SPEED_ATTRS]]
4660// SIZE-OPT-NOT: minsize
0 commit comments