File tree Expand file tree Collapse file tree 2 files changed +127
-0
lines changed Expand file tree Collapse file tree 2 files changed +127
-0
lines changed Original file line number Diff line number Diff line change
1
+ - // MIR for `main` before CopyProp
2
+ + // MIR for `main` after CopyProp
3
+
4
+ fn main() -> () {
5
+ let mut _0: ();
6
+ let _1: ();
7
+ let _2: main::S;
8
+ let _3: ();
9
+ let mut _4: main::S;
10
+ let _5: ();
11
+ let _6: main::S;
12
+ let _7: ();
13
+ let mut _8: main::S;
14
+ let _9: ();
15
+ let _10: main::C;
16
+ let _11: ();
17
+ let mut _12: main::C;
18
+ let _13: main::C;
19
+ let _14: ();
20
+ let mut _15: main::C;
21
+ scope 1 {
22
+ debug s1 => _2;
23
+ }
24
+ scope 2 {
25
+ debug s2 => _6;
26
+ }
27
+ scope 3 {
28
+ debug c1 => _10;
29
+ }
30
+ scope 4 {
31
+ debug c2 => _13;
32
+ }
33
+
34
+ bb0: {
35
+ - StorageLive(_1);
36
+ - StorageLive(_2);
37
+ _2 = S(const 1_usize, const 2_usize);
38
+ StorageLive(_3);
39
+ - StorageLive(_4);
40
+ - _4 = move _2;
41
+ - _3 = std::mem::drop::<S>(move _4) -> [return: bb1, unwind continue];
42
+ + _3 = std::mem::drop::<S>(move _2) -> [return: bb1, unwind continue];
43
+ }
44
+
45
+ bb1: {
46
+ - StorageDead(_4);
47
+ StorageDead(_3);
48
+ - _1 = const ();
49
+ - StorageDead(_2);
50
+ - StorageDead(_1);
51
+ - StorageLive(_5);
52
+ - StorageLive(_6);
53
+ _6 = S(const 3_usize, const 4_usize);
54
+ StorageLive(_7);
55
+ - StorageLive(_8);
56
+ - _8 = move _6;
57
+ - _7 = std::mem::drop::<S>(move _8) -> [return: bb2, unwind continue];
58
+ + _7 = std::mem::drop::<S>(move _6) -> [return: bb2, unwind continue];
59
+ }
60
+
61
+ bb2: {
62
+ - StorageDead(_8);
63
+ StorageDead(_7);
64
+ - _5 = const ();
65
+ - StorageDead(_6);
66
+ - StorageDead(_5);
67
+ - StorageLive(_9);
68
+ - StorageLive(_10);
69
+ _10 = C(const 1_usize, const 2_usize);
70
+ StorageLive(_11);
71
+ - StorageLive(_12);
72
+ - _12 = copy _10;
73
+ - _11 = std::mem::drop::<C>(move _12) -> [return: bb3, unwind continue];
74
+ + _11 = std::mem::drop::<C>(copy _10) -> [return: bb3, unwind continue];
75
+ }
76
+
77
+ bb3: {
78
+ - StorageDead(_12);
79
+ StorageDead(_11);
80
+ - _9 = const ();
81
+ - StorageDead(_10);
82
+ - StorageDead(_9);
83
+ - StorageLive(_13);
84
+ _13 = C(const 3_usize, const 4_usize);
85
+ StorageLive(_14);
86
+ - StorageLive(_15);
87
+ - _15 = copy _13;
88
+ - _14 = std::mem::drop::<C>(move _15) -> [return: bb4, unwind continue];
89
+ + _14 = std::mem::drop::<C>(copy _13) -> [return: bb4, unwind continue];
90
+ }
91
+
92
+ bb4: {
93
+ - StorageDead(_15);
94
+ StorageDead(_14);
95
+ _0 = const ();
96
+ - StorageDead(_13);
97
+ return;
98
+ }
99
+ }
100
+
Original file line number Diff line number Diff line change
1
+ // skip-filecheck
2
+ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY
3
+ //@ test-mir-pass: CopyProp
4
+
5
+ // EMIT_MIR issue_141649.main.CopyProp.diff
6
+ fn main ( ) {
7
+ struct S ( usize , usize ) ;
8
+ {
9
+ let s1 = S ( 1 , 2 ) ;
10
+ drop ( s1) ;
11
+ }
12
+ {
13
+ let s2 = S ( 3 , 4 ) ;
14
+ drop ( s2) ;
15
+ }
16
+
17
+ #[ derive( Clone , Copy ) ]
18
+ struct C ( usize , usize ) ;
19
+ {
20
+ let c1 = C ( 1 , 2 ) ;
21
+ drop ( c1) ;
22
+ }
23
+ {
24
+ let c2 = C ( 3 , 4 ) ;
25
+ drop ( c2) ;
26
+ }
27
+ }
You can’t perform that action at this time.
0 commit comments