Skip to content

Commit 732f6a1

Browse files
committed
Add FileCheck to struct.rs
1 parent d765e3a commit 732f6a1

File tree

3 files changed

+72
-31
lines changed

3 files changed

+72
-31
lines changed

tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.32bit.diff

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,33 +37,33 @@
3737
let _8: std::option::Option<S>;
3838
let _9: &[f32];
3939
scope 4 {
40-
debug a => _7;
41-
debug b => _8;
42-
debug c => _9;
40+
debug a1 => _7;
41+
debug b1 => _8;
42+
debug c1 => _9;
4343
let _11: f32;
4444
let _12: std::option::Option<S>;
4545
let _13: &[f32];
4646
scope 5 {
47-
debug a => _11;
48-
debug b => _12;
49-
debug c => _13;
47+
debug a2 => _11;
48+
debug b2 => _12;
49+
debug c2 => _13;
5050
let _15: SmallStruct;
5151
scope 6 {
5252
debug ss => _15;
5353
let _19: f32;
5454
let _20: std::option::Option<S>;
5555
let _21: &[f32];
5656
scope 7 {
57-
debug a => _19;
58-
debug b => _20;
59-
debug c => _21;
57+
debug a3 => _19;
58+
debug b3 => _20;
59+
debug c3 => _21;
6060
let _23: f32;
6161
let _24: std::option::Option<S>;
6262
let _25: &[f32];
6363
scope 8 {
64-
debug a => _23;
65-
debug b => _24;
66-
debug c => _25;
64+
debug a4 => _23;
65+
debug b4 => _24;
66+
debug c4 => _25;
6767
let _27: BigStruct;
6868
scope 9 {
6969
debug bs => _27;

tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.64bit.diff

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,33 +37,33 @@
3737
let _8: std::option::Option<S>;
3838
let _9: &[f32];
3939
scope 4 {
40-
debug a => _7;
41-
debug b => _8;
42-
debug c => _9;
40+
debug a1 => _7;
41+
debug b1 => _8;
42+
debug c1 => _9;
4343
let _11: f32;
4444
let _12: std::option::Option<S>;
4545
let _13: &[f32];
4646
scope 5 {
47-
debug a => _11;
48-
debug b => _12;
49-
debug c => _13;
47+
debug a2 => _11;
48+
debug b2 => _12;
49+
debug c2 => _13;
5050
let _15: SmallStruct;
5151
scope 6 {
5252
debug ss => _15;
5353
let _19: f32;
5454
let _20: std::option::Option<S>;
5555
let _21: &[f32];
5656
scope 7 {
57-
debug a => _19;
58-
debug b => _20;
59-
debug c => _21;
57+
debug a3 => _19;
58+
debug b3 => _20;
59+
debug c3 => _21;
6060
let _23: f32;
6161
let _24: std::option::Option<S>;
6262
let _25: &[f32];
6363
scope 8 {
64-
debug a => _23;
65-
debug b => _24;
66-
debug c => _25;
64+
debug a4 => _23;
65+
debug b4 => _24;
66+
debug c4 => _25;
6767
let _27: BigStruct;
6868
scope 9 {
6969
debug bs => _27;
Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// skip-filecheck
21
// unit-test: DataflowConstProp
32
// EMIT_MIR_FOR_EACH_BIT_WIDTH
43

@@ -12,27 +11,69 @@ struct SmallStruct(f32, Option<S>, &'static [f32]);
1211
struct BigStruct(f32, Option<S>, &'static [f32]);
1312

1413
// EMIT_MIR struct.main.DataflowConstProp.diff
14+
15+
// CHECK-LABEL: fn main
1516
fn main() {
17+
// CHECK: debug s => [[s:_[0-9]+]];
18+
// CHECK: debug a => [[a:_[0-9]+]];
19+
// CHECK: debug b => [[b:_[0-9]+]];
20+
// CHECK: debug a1 => [[a1:_[0-9]+]];
21+
// CHECK: debug b1 => [[b1:_[0-9]+]];
22+
// CHECK: debug c1 => [[c1:_[0-9]+]];
23+
// CHECK: debug a2 => [[a2:_[0-9]+]];
24+
// CHECK: debug b2 => [[b2:_[0-9]+]];
25+
// CHECK: debug c2 => [[c2:_[0-9]+]];
26+
// CHECK: debug ss => [[ss:_[0-9]+]];
27+
// CHECK: debug a3 => [[a3:_[0-9]+]];
28+
// CHECK: debug b3 => [[b3:_[0-9]+]];
29+
// CHECK: debug c3 => [[c3:_[0-9]+]];
30+
// CHECK: debug a4 => [[a4:_[0-9]+]];
31+
// CHECK: debug b4 => [[b4:_[0-9]+]];
32+
// CHECK: debug c4 => [[c4:_[0-9]+]];
33+
// CHECK: debug bs => [[bs:_[0-9]+]];
34+
35+
// CHECK: [[s]] = const S(1_i32);
1636
let mut s = S(1);
37+
38+
// CHECK: [[a]] = const 3_i32;
1739
let a = s.0 + 2;
1840
s.0 = 3;
41+
42+
// CHECK: [[b]] = const 6_i32;
1943
let b = a + s.0;
2044

2145
const SMALL_VAL: SmallStruct = SmallStruct(4., Some(S(1)), &[]);
22-
let SmallStruct(a, b, c) = SMALL_VAL;
46+
47+
// CHECK: [[a1]] = const 4f32;
48+
// CHECK: [[b1]] = const Option::<S>::Some(S(1_i32));
49+
// CHECK: [[c1]] = ({{_[0-9]+}}.2: &[f32]);
50+
let SmallStruct(a1, b1, c1) = SMALL_VAL;
2351

2452
static SMALL_STAT: &SmallStruct = &SmallStruct(9., None, &[13.]);
25-
let SmallStruct(a, b, c) = *SMALL_STAT;
2653

27-
let ss = SmallStruct(a, b, c);
54+
// CHECK: [[a2]] = const 9f32;
55+
// CHECK: [[b2]] = ((*{{_[0-9]+}}).1: std::option::Option<S>);
56+
// CHECK: [[c2]] = ((*{{_[0-9]+}}).2: &[f32]);
57+
let SmallStruct(a2, b2, c2) = *SMALL_STAT;
58+
59+
// CHECK: [[ss]] = SmallStruct(const 9f32, move {{_[0-9]+}}, move {{_[0-9]+}});
60+
let ss = SmallStruct(a2, b2, c2);
2861

2962
const BIG_VAL: BigStruct = BigStruct(25., None, &[]);
30-
let BigStruct(a, b, c) = BIG_VAL;
63+
64+
// CHECK: [[a3]] = const 25f32;
65+
// CHECK: [[b3]] = ({{_[0-9]+}}.1: std::option::Option<S>);
66+
// CHECK: [[c3]] = ({{_[0-9]+}}.2: &[f32]);
67+
let BigStruct(a3, b3, c3) = BIG_VAL;
3168

3269
static BIG_STAT: &BigStruct = &BigStruct(82., Some(S(35)), &[45., 72.]);
33-
let BigStruct(a, b, c) = *BIG_STAT;
70+
// CHECK: [[a4]] = const 82f32;
71+
// CHECK: [[b4]] = const Option::<S>::Some(S(35_i32));
72+
// CHECK: [[c4]] = ((*{{_[0-9]+}}).2: &[f32]);
73+
let BigStruct(a4, b4, c4) = *BIG_STAT;
3474

3575
// We arbitrarily limit the size of synthetized values to 4 pointers.
3676
// `BigStruct` can be read, but we will keep a MIR aggregate for this.
37-
let bs = BigStruct(a, b, c);
77+
// CHECK: [[bs]] = BigStruct(const 82f32, const Option::<S>::Some(S(35_i32)), move {{_[0-9]+}});
78+
let bs = BigStruct(a4, b4, c4);
3879
}

0 commit comments

Comments
 (0)