1
- // skip-filecheck
2
1
// unit-test: DataflowConstProp
3
2
// EMIT_MIR_FOR_EACH_BIT_WIDTH
4
3
@@ -12,27 +11,69 @@ struct SmallStruct(f32, Option<S>, &'static [f32]);
12
11
struct BigStruct ( f32 , Option < S > , & ' static [ f32 ] ) ;
13
12
14
13
// EMIT_MIR struct.main.DataflowConstProp.diff
14
+
15
+ // CHECK-LABEL: fn main
15
16
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);
16
36
let mut s = S ( 1 ) ;
37
+
38
+ // CHECK: [[a]] = const 3_i32;
17
39
let a = s. 0 + 2 ;
18
40
s. 0 = 3 ;
41
+
42
+ // CHECK: [[b]] = const 6_i32;
19
43
let b = a + s. 0 ;
20
44
21
45
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 ;
23
51
24
52
static SMALL_STAT : & SmallStruct = & SmallStruct ( 9. , None , & [ 13. ] ) ;
25
- let SmallStruct ( a, b, c) = * SMALL_STAT ;
26
53
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) ;
28
61
29
62
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 ;
31
68
32
69
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 ;
34
74
35
75
// We arbitrarily limit the size of synthetized values to 4 pointers.
36
76
// `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) ;
38
79
}
0 commit comments