1- //@ revisions: NO-OPT SIZE-OPT SPEED-OPT
1+ //@ revisions: NO-OPT DEBUGINFO SIZE-OPT SPEED-OPT
22//@[NO-OPT] compile-flags: -Copt-level=0 -Ccodegen-units=1
3+ //@[DEBUGINFO] compile-flags: -Copt-level=1 -Ccodegen-units=1 -Cdebuginfo=full -Zmir_strip_debuginfo=all-locals
34//@[SIZE-OPT] compile-flags: -Copt-level=s -Ccodegen-units=1
45//@[SPEED-OPT] compile-flags: -Copt-level=3 -Ccodegen-units=1
56
@@ -27,6 +28,7 @@ pub fn size() -> i32 {
2728
2829// CHECK-LABEL: define{{.*}}i32 @speed
2930// NO-OPT-SAME: [[NOTHING_ATTRS]]
31+ // DEBUGINFO-SAME: [[NOTHING_ATTRS]]
3032// SPEED-OPT-SAME: [[NOTHING_ATTRS]]
3133// SIZE-OPT-SAME: [[SPEED_ATTRS:#[0-9]+]]
3234// SIZE-OPT: ret i32 8
@@ -41,14 +43,16 @@ pub fn speed() -> i32 {
4143// CHECK-SAME: [[NONE_ATTRS:#[0-9]+]]
4244// SIZE-OPT: alloca
4345// SPEED-OPT: alloca
46+ // DEBUGINFO-DAG: !DILocalVariable(name: "some_local_variable"
4447#[ no_mangle]
4548#[ optimize( none) ]
4649pub fn none ( ) -> i32 {
47- let arr = [ 0 , 1 , 2 , 3 , 4 ] ;
48- arr [ 4 ]
50+ let some_local_variable = [ 0 , 1 , 2 , 3 , 4 ] ;
51+ some_local_variable [ 4 ]
4952}
5053
5154// NO-OPT-DAG: attributes [[SIZE_ATTRS]] = {{.*}}minsize{{.*}}optsize{{.*}}
55+ // DEBUGINFO-DAG: attributes [[SIZE_ATTRS]] = {{.*}}minsize{{.*}}optsize{{.*}}
5256// SPEED-OPT-DAG: attributes [[SIZE_ATTRS]] = {{.*}}minsize{{.*}}optsize{{.*}}
5357// SIZE-OPT-DAG: attributes [[NOTHING_ATTRS]] = {{.*}}optsize{{.*}}
5458// SIZE-OPT-DAG: attributes [[SIZE_ATTRS]] = {{.*}}minsize{{.*}}optsize{{.*}}
0 commit comments