Skip to content

Commit e65ec7d

Browse files
committed
FileCheck const_debuginfo.
1 parent 3d45470 commit e65ec7d

File tree

2 files changed

+66
-42
lines changed

2 files changed

+66
-42
lines changed

Diff for: tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff

+53-38
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
fn main() -> () {
55
let mut _0: ();
66
let _1: u8;
7+
let mut _5: u8;
8+
let mut _6: u8;
9+
let mut _7: u8;
10+
let mut _8: u8;
11+
let mut _14: u32;
12+
let mut _15: u32;
713
scope 1 {
814
- debug x => _1;
915
+ debug x => const 1_u8;
@@ -19,34 +25,23 @@
1925
scope 4 {
2026
- debug sum => _4;
2127
+ debug sum => const 6_u8;
22-
let _5: &str;
28+
let _9: &str;
2329
scope 5 {
24-
- debug s => _5;
30+
- debug s => _9;
2531
+ debug s => const "hello, world!";
26-
let _8: bool;
27-
let _9: bool;
28-
let _10: u32;
32+
let _10: (bool, bool, u32);
2933
scope 6 {
30-
- debug ((f: (bool, bool, u32)).0: bool) => _8;
31-
- debug ((f: (bool, bool, u32)).1: bool) => _9;
32-
- debug ((f: (bool, bool, u32)).2: u32) => _10;
33-
+ debug ((f: (bool, bool, u32)).0: bool) => const true;
34-
+ debug ((f: (bool, bool, u32)).1: bool) => const false;
35-
+ debug ((f: (bool, bool, u32)).2: u32) => const 123_u32;
36-
let _6: std::option::Option<u16>;
34+
debug f => _10;
35+
let _11: std::option::Option<u16>;
3736
scope 7 {
38-
- debug o => _6;
39-
+ debug o => const Option::<u16>::Some(99_u16);
40-
let _11: u32;
41-
let _12: u32;
37+
debug o => _11;
38+
let _12: Point;
4239
scope 8 {
43-
- debug ((p: Point).0: u32) => _11;
44-
- debug ((p: Point).1: u32) => _12;
45-
+ debug ((p: Point).0: u32) => const 32_u32;
46-
+ debug ((p: Point).1: u32) => const 32_u32;
47-
let _7: u32;
40+
- debug p => _12;
41+
+ debug p => const Point {{ x: 32_u32, y: 32_u32 }};
42+
let _13: u32;
4843
scope 9 {
49-
- debug a => _7;
44+
- debug a => _13;
5045
+ debug a => const 64_u32;
5146
}
5247
}
@@ -59,37 +54,57 @@
5954
}
6055

6156
bb0: {
57+
StorageLive(_1);
6258
_1 = const 1_u8;
59+
StorageLive(_2);
6360
_2 = const 2_u8;
61+
StorageLive(_3);
6462
_3 = const 3_u8;
6563
StorageLive(_4);
66-
_4 = const 6_u8;
6764
StorageLive(_5);
68-
_5 = const "hello, world!";
69-
StorageLive(_8);
70-
StorageLive(_9);
71-
StorageLive(_10);
72-
_8 = const true;
73-
_9 = const false;
74-
_10 = const 123_u32;
7565
StorageLive(_6);
76-
_6 = const Option::<u16>::Some(99_u16);
77-
_11 = const 32_u32;
78-
_12 = const 32_u32;
66+
_6 = const 1_u8;
7967
StorageLive(_7);
80-
_7 = const 64_u32;
68+
_7 = const 2_u8;
69+
_5 = const 3_u8;
8170
StorageDead(_7);
8271
StorageDead(_6);
72+
StorageLive(_8);
73+
_8 = const 3_u8;
74+
_4 = const 6_u8;
8375
StorageDead(_8);
84-
StorageDead(_9);
85-
StorageDead(_10);
8676
StorageDead(_5);
77+
StorageLive(_9);
78+
_9 = const "hello, world!";
79+
StorageLive(_10);
80+
_10 = (const true, const false, const 123_u32);
81+
StorageLive(_11);
82+
_11 = Option::<u16>::Some(const 99_u16);
83+
StorageLive(_12);
84+
_12 = const Point {{ x: 32_u32, y: 32_u32 }};
85+
StorageLive(_13);
86+
StorageLive(_14);
87+
_14 = const 32_u32;
88+
StorageLive(_15);
89+
_15 = const 32_u32;
90+
_13 = const 64_u32;
91+
StorageDead(_15);
92+
StorageDead(_14);
93+
_0 = const ();
94+
StorageDead(_13);
95+
StorageDead(_12);
96+
StorageDead(_11);
97+
StorageDead(_10);
98+
StorageDead(_9);
8799
StorageDead(_4);
100+
StorageDead(_3);
101+
StorageDead(_2);
102+
StorageDead(_1);
88103
return;
89104
}
90105
}
91106

92-
ALLOC0 (size: 4, align: 2) {
93-
01 00 63 00 │ ..c.
107+
ALLOC0 (size: 8, align: 4) {
108+
20 00 00 00 20 00 00 00 │ ... ...
94109
}
95110

Diff for: tests/mir-opt/const_debuginfo.rs

+13-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
1-
// skip-filecheck
2-
// compile-flags: -C overflow-checks=no -Zunsound-mir-opts
1+
// unit-test: ConstDebugInfo
2+
// compile-flags: -C overflow-checks=no -Zmir-enable-passes=+ConstProp
33

44
struct Point {
55
x: u32,
66
y: u32,
77
}
88

9+
// EMIT_MIR const_debuginfo.main.ConstDebugInfo.diff
910
fn main() {
11+
// CHECK-LABEL: fn main(
12+
// CHECK: debug x => const 1_u8;
13+
// CHECK: debug y => const 2_u8;
14+
// CHECK: debug z => const 3_u8;
15+
// CHECK: debug sum => const 6_u8;
16+
// CHECK: debug s => const "hello, world!";
17+
// CHECK: debug f => {{_.*}};
18+
// CHECK: debug o => {{_.*}};
19+
// CHECK: debug p => const Point
20+
// CHECK: debug a => const 64_u32;
1021
let x = 1u8;
1122
let y = 2u8;
1223
let z = 3u8;
@@ -21,5 +32,3 @@ fn main() {
2132
let p = Point { x: 32, y: 32 };
2233
let a = p.x + p.y;
2334
}
24-
25-
// EMIT_MIR const_debuginfo.main.ConstDebugInfo.diff

0 commit comments

Comments
 (0)