Skip to content

Commit 8ba0cd6

Browse files
committed
Make tests unit.
1 parent 7919ef0 commit 8ba0cd6

12 files changed

+37
-92
lines changed

tests/mir-opt/const_prop/ref_deref.main.ConstProp.diff

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@
1313
StorageLive(_2); // scope 0 at $DIR/ref_deref.rs:+1:6: +1:10
1414
_4 = const _; // scope 0 at $DIR/ref_deref.rs:+1:6: +1:10
1515
// mir::Constant
16-
// + span: $DIR/ref_deref.rs:6:6: 6:10
16+
// + span: $DIR/ref_deref.rs:5:6: 5:10
1717
// + literal: Const { ty: &i32, val: Unevaluated(main, [], Some(promoted[0])) }
18-
_2 = _4; // scope 0 at $DIR/ref_deref.rs:+1:6: +1:10
19-
- _1 = (*_2); // scope 0 at $DIR/ref_deref.rs:+1:5: +1:10
20-
+ _1 = const 4_i32; // scope 0 at $DIR/ref_deref.rs:+1:5: +1:10
18+
_2 = &(*_4); // scope 0 at $DIR/ref_deref.rs:+1:6: +1:10
19+
_1 = (*_2); // scope 0 at $DIR/ref_deref.rs:+1:5: +1:10
2120
StorageDead(_2); // scope 0 at $DIR/ref_deref.rs:+1:10: +1:11
2221
StorageDead(_1); // scope 0 at $DIR/ref_deref.rs:+1:10: +1:11
23-
nop; // scope 0 at $DIR/ref_deref.rs:+0:11: +2:2
22+
_0 = const (); // scope 0 at $DIR/ref_deref.rs:+0:11: +2:2
2423
return; // scope 0 at $DIR/ref_deref.rs:+2:2: +2:2
2524
}
2625
}

tests/mir-opt/const_prop/ref_deref.main.PromoteTemps.diff

Lines changed: 0 additions & 30 deletions
This file was deleted.

tests/mir-opt/const_prop/ref_deref.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// compile-flags: -Zmir-enable-passes=-SimplifyLocals-before-const-prop
2-
// EMIT_MIR ref_deref.main.PromoteTemps.diff
1+
// unit-test: ConstProp
32
// EMIT_MIR ref_deref.main.ConstProp.diff
43

54
fn main() {

tests/mir-opt/const_prop/ref_deref_project.main.ConstProp.diff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
StorageLive(_2); // scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17
1414
_4 = const _; // scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17
1515
// mir::Constant
16-
// + span: $DIR/ref_deref_project.rs:6:6: 6:17
16+
// + span: $DIR/ref_deref_project.rs:5:6: 5:17
1717
// + literal: Const { ty: &(i32, i32), val: Unevaluated(main, [], Some(promoted[0])) }
1818
_2 = &((*_4).1: i32); // scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17
1919
_1 = (*_2); // scope 0 at $DIR/ref_deref_project.rs:+1:5: +1:17
2020
StorageDead(_2); // scope 0 at $DIR/ref_deref_project.rs:+1:17: +1:18
2121
StorageDead(_1); // scope 0 at $DIR/ref_deref_project.rs:+1:17: +1:18
22-
nop; // scope 0 at $DIR/ref_deref_project.rs:+0:11: +2:2
22+
_0 = const (); // scope 0 at $DIR/ref_deref_project.rs:+0:11: +2:2
2323
return; // scope 0 at $DIR/ref_deref_project.rs:+2:2: +2:2
2424
}
2525
}

tests/mir-opt/const_prop/ref_deref_project.main.PromoteTemps.diff

Lines changed: 0 additions & 30 deletions
This file was deleted.

tests/mir-opt/const_prop/ref_deref_project.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// compile-flags: -Zmir-enable-passes=-SimplifyLocals-before-const-prop
2-
// EMIT_MIR ref_deref_project.main.PromoteTemps.diff
1+
// unit-test: ConstProp
32
// EMIT_MIR ref_deref_project.main.ConstProp.diff
43

54
fn main() {

tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.diff

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
StorageLive(_4); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19
2121
_9 = const _; // scope 0 at $DIR/slice_len.rs:+1:6: +1:19
2222
// mir::Constant
23-
// + span: $DIR/slice_len.rs:6:6: 6:19
23+
// + span: $DIR/slice_len.rs:7:6: 7:19
2424
// + literal: Const { ty: &[u32; 3], val: Unevaluated(main, [], Some(promoted[0])) }
2525
_4 = _9; // scope 0 at $DIR/slice_len.rs:+1:6: +1:19
2626
_3 = _4; // scope 0 at $DIR/slice_len.rs:+1:6: +1:19
@@ -33,7 +33,7 @@
3333
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
3434
+ _7 = const 3_usize; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
3535
+ _8 = const true; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
36-
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> bb1; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
36+
+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
3737
}
3838

3939
bb1: {
@@ -43,7 +43,7 @@
4343
StorageDead(_4); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34
4444
StorageDead(_2); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34
4545
StorageDead(_1); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34
46-
nop; // scope 0 at $DIR/slice_len.rs:+0:11: +2:2
46+
_0 = const (); // scope 0 at $DIR/slice_len.rs:+0:11: +2:2
4747
return; // scope 0 at $DIR/slice_len.rs:+2:2: +2:2
4848
}
4949
}

tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.diff

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
StorageLive(_4); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19
2121
_9 = const _; // scope 0 at $DIR/slice_len.rs:+1:6: +1:19
2222
// mir::Constant
23-
// + span: $DIR/slice_len.rs:6:6: 6:19
23+
// + span: $DIR/slice_len.rs:7:6: 7:19
2424
// + literal: Const { ty: &[u32; 3], val: Unevaluated(main, [], Some(promoted[0])) }
2525
_4 = _9; // scope 0 at $DIR/slice_len.rs:+1:6: +1:19
2626
_3 = _4; // scope 0 at $DIR/slice_len.rs:+1:6: +1:19
@@ -33,7 +33,7 @@
3333
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
3434
+ _7 = const 3_usize; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
3535
+ _8 = const true; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
36-
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> bb1; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
36+
+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
3737
}
3838

3939
bb1: {
@@ -43,7 +43,7 @@
4343
StorageDead(_4); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34
4444
StorageDead(_2); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34
4545
StorageDead(_1); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34
46-
nop; // scope 0 at $DIR/slice_len.rs:+0:11: +2:2
46+
_0 = const (); // scope 0 at $DIR/slice_len.rs:+0:11: +2:2
4747
return; // scope 0 at $DIR/slice_len.rs:+2:2: +2:2
4848
}
4949
}

tests/mir-opt/const_prop/slice_len.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// compile-flags: -Zmir-enable-passes=-SimplifyLocals-before-const-prop
1+
// unit-test: ConstProp
2+
// compile-flags: -Zmir-enable-passes=+InstCombine
23
// EMIT_MIR_FOR_EACH_BIT_WIDTH
34

45
// EMIT_MIR slice_len.main.ConstProp.diff

tests/mir-opt/const_prop_miscompile.bar.ConstProp.diff

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,37 @@
44
fn bar() -> () {
55
let mut _0: (); // return place in scope 0 at $DIR/const_prop_miscompile.rs:+0:10: +0:10
66
let mut _1: (i32,); // in scope 0 at $DIR/const_prop_miscompile.rs:+1:9: +1:14
7-
let mut _2: *mut i32; // in scope 0 at $DIR/const_prop_miscompile.rs:+3:10: +3:22
8-
let mut _4: i32; // in scope 0 at $DIR/const_prop_miscompile.rs:+5:13: +5:20
7+
let _2: (); // in scope 0 at $DIR/const_prop_miscompile.rs:+2:5: +4:6
8+
let mut _3: *mut i32; // in scope 0 at $DIR/const_prop_miscompile.rs:+3:10: +3:22
9+
let mut _5: i32; // in scope 0 at $DIR/const_prop_miscompile.rs:+5:13: +5:20
910
scope 1 {
1011
debug v => _1; // in scope 1 at $DIR/const_prop_miscompile.rs:+1:9: +1:14
11-
let _3: bool; // in scope 1 at $DIR/const_prop_miscompile.rs:+5:9: +5:10
12+
let _4: bool; // in scope 1 at $DIR/const_prop_miscompile.rs:+5:9: +5:10
1213
scope 2 {
1314
}
1415
scope 3 {
15-
debug y => _3; // in scope 3 at $DIR/const_prop_miscompile.rs:+5:9: +5:10
16+
debug y => _4; // in scope 3 at $DIR/const_prop_miscompile.rs:+5:9: +5:10
1617
}
1718
}
1819

1920
bb0: {
2021
StorageLive(_1); // scope 0 at $DIR/const_prop_miscompile.rs:+1:9: +1:14
2122
Deinit(_1); // scope 0 at $DIR/const_prop_miscompile.rs:+1:17: +1:21
2223
(_1.0: i32) = const 1_i32; // scope 0 at $DIR/const_prop_miscompile.rs:+1:17: +1:21
23-
StorageLive(_2); // scope 2 at $DIR/const_prop_miscompile.rs:+3:10: +3:22
24-
_2 = &raw mut (_1.0: i32); // scope 2 at $DIR/const_prop_miscompile.rs:+3:10: +3:22
25-
(*_2) = const 5_i32; // scope 2 at $DIR/const_prop_miscompile.rs:+3:9: +3:26
26-
StorageDead(_2); // scope 2 at $DIR/const_prop_miscompile.rs:+3:26: +3:27
27-
StorageLive(_3); // scope 1 at $DIR/const_prop_miscompile.rs:+5:9: +5:10
28-
StorageLive(_4); // scope 1 at $DIR/const_prop_miscompile.rs:+5:13: +5:20
29-
_4 = (_1.0: i32); // scope 1 at $DIR/const_prop_miscompile.rs:+5:15: +5:18
30-
_3 = Eq(move _4, const 5_i32); // scope 1 at $DIR/const_prop_miscompile.rs:+5:13: +5:25
31-
StorageDead(_4); // scope 1 at $DIR/const_prop_miscompile.rs:+5:24: +5:25
32-
StorageDead(_3); // scope 1 at $DIR/const_prop_miscompile.rs:+6:1: +6:2
24+
StorageLive(_2); // scope 1 at $DIR/const_prop_miscompile.rs:+2:5: +4:6
25+
StorageLive(_3); // scope 2 at $DIR/const_prop_miscompile.rs:+3:10: +3:22
26+
_3 = &raw mut (_1.0: i32); // scope 2 at $DIR/const_prop_miscompile.rs:+3:10: +3:22
27+
(*_3) = const 5_i32; // scope 2 at $DIR/const_prop_miscompile.rs:+3:9: +3:26
28+
StorageDead(_3); // scope 2 at $DIR/const_prop_miscompile.rs:+3:26: +3:27
29+
_2 = const (); // scope 2 at $DIR/const_prop_miscompile.rs:+2:5: +4:6
30+
StorageDead(_2); // scope 1 at $DIR/const_prop_miscompile.rs:+4:5: +4:6
31+
StorageLive(_4); // scope 1 at $DIR/const_prop_miscompile.rs:+5:9: +5:10
32+
StorageLive(_5); // scope 1 at $DIR/const_prop_miscompile.rs:+5:13: +5:20
33+
_5 = (_1.0: i32); // scope 1 at $DIR/const_prop_miscompile.rs:+5:15: +5:18
34+
_4 = Eq(move _5, const 5_i32); // scope 1 at $DIR/const_prop_miscompile.rs:+5:13: +5:25
35+
StorageDead(_5); // scope 1 at $DIR/const_prop_miscompile.rs:+5:24: +5:25
36+
_0 = const (); // scope 0 at $DIR/const_prop_miscompile.rs:+0:10: +6:2
37+
StorageDead(_4); // scope 1 at $DIR/const_prop_miscompile.rs:+6:1: +6:2
3338
StorageDead(_1); // scope 0 at $DIR/const_prop_miscompile.rs:+6:1: +6:2
3439
return; // scope 0 at $DIR/const_prop_miscompile.rs:+6:2: +6:2
3540
}

tests/mir-opt/const_prop_miscompile.foo.ConstProp.diff

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
_4 = (_1.0: i32); // scope 1 at $DIR/const_prop_miscompile.rs:+3:15: +3:18
2828
_3 = Eq(move _4, const 5_i32); // scope 1 at $DIR/const_prop_miscompile.rs:+3:13: +3:25
2929
StorageDead(_4); // scope 1 at $DIR/const_prop_miscompile.rs:+3:24: +3:25
30+
_0 = const (); // scope 0 at $DIR/const_prop_miscompile.rs:+0:10: +4:2
3031
StorageDead(_3); // scope 1 at $DIR/const_prop_miscompile.rs:+4:1: +4:2
3132
StorageDead(_1); // scope 0 at $DIR/const_prop_miscompile.rs:+4:1: +4:2
3233
return; // scope 0 at $DIR/const_prop_miscompile.rs:+4:2: +4:2

tests/mir-opt/const_prop_miscompile.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// unit-test: ConstProp
12
#![feature(raw_ref_op)]
23

34
// EMIT_MIR const_prop_miscompile.foo.ConstProp.diff

0 commit comments

Comments
 (0)