Skip to content

Commit 2080a93

Browse files
simplify_try: print dest_prop diff and bless
The new diff is to convince me that this is correct and nothing funky is going on.
1 parent 19cd910 commit 2080a93

File tree

3 files changed

+76
-2
lines changed

3 files changed

+76
-2
lines changed

src/test/mir-opt/simplify_try.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ fn try_identity(x: Result<u32, i32>) -> Result<u32, i32> {
1010
fn main() {
1111
let _ = try_identity(Ok(0));
1212
}
13+
14+
// EMIT_MIR rustc.try_identity.DestinationPropagation.diff
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
- // MIR for `try_identity` before DestinationPropagation
2+
+ // MIR for `try_identity` after DestinationPropagation
3+
4+
fn try_identity(_1: std::result::Result<u32, i32>) -> std::result::Result<u32, i32> {
5+
debug x => _1; // in scope 0 at $DIR/simplify_try.rs:5:17: 5:18
6+
let mut _0: std::result::Result<u32, i32>; // return place in scope 0 at $DIR/simplify_try.rs:5:41: 5:57
7+
let _2: u32; // in scope 0 at $DIR/simplify_try.rs:6:9: 6:10
8+
let mut _3: std::result::Result<u32, i32>; // in scope 0 at $DIR/simplify_try.rs:6:13: 6:15
9+
let mut _4: std::result::Result<u32, i32>; // in scope 0 at $DIR/simplify_try.rs:6:13: 6:14
10+
let mut _5: isize; // in scope 0 at $DIR/simplify_try.rs:6:14: 6:15
11+
let _6: i32; // in scope 0 at $DIR/simplify_try.rs:6:14: 6:15
12+
let mut _7: !; // in scope 0 at $DIR/simplify_try.rs:6:14: 6:15
13+
let mut _8: i32; // in scope 0 at $DIR/simplify_try.rs:6:14: 6:15
14+
let mut _9: i32; // in scope 0 at $DIR/simplify_try.rs:6:14: 6:15
15+
let _10: u32; // in scope 0 at $DIR/simplify_try.rs:6:13: 6:15
16+
let mut _11: u32; // in scope 0 at $DIR/simplify_try.rs:7:8: 7:9
17+
scope 1 {
18+
debug y => _2; // in scope 1 at $DIR/simplify_try.rs:6:9: 6:10
19+
}
20+
scope 2 {
21+
debug err => _6; // in scope 2 at $DIR/simplify_try.rs:6:14: 6:15
22+
scope 3 {
23+
scope 7 {
24+
debug t => _9; // in scope 7 at $SRC_DIR/libcore/convert/mod.rs:LL:COL
25+
}
26+
scope 8 {
27+
debug v => _8; // in scope 8 at $SRC_DIR/libcore/result.rs:LL:COL
28+
let mut _12: i32; // in scope 8 at $DIR/simplify_try.rs:6:14: 6:15
29+
}
30+
}
31+
}
32+
scope 4 {
33+
debug val => _10; // in scope 4 at $DIR/simplify_try.rs:6:13: 6:15
34+
scope 5 {
35+
}
36+
}
37+
scope 6 {
38+
- debug self => _4; // in scope 6 at $SRC_DIR/libcore/result.rs:LL:COL
39+
+ debug self => _0; // in scope 6 at $SRC_DIR/libcore/result.rs:LL:COL
40+
}
41+
42+
bb0: {
43+
StorageLive(_2); // scope 0 at $DIR/simplify_try.rs:6:9: 6:10
44+
- StorageLive(_3); // scope 0 at $DIR/simplify_try.rs:6:13: 6:15
45+
- StorageLive(_4); // scope 0 at $DIR/simplify_try.rs:6:13: 6:14
46+
- _4 = _1; // scope 0 at $DIR/simplify_try.rs:6:13: 6:14
47+
- _3 = move _4; // scope 6 at $SRC_DIR/libcore/result.rs:LL:COL
48+
- StorageDead(_4); // scope 0 at $DIR/simplify_try.rs:6:14: 6:15
49+
- _5 = discriminant(_3); // scope 0 at $DIR/simplify_try.rs:6:14: 6:15
50+
+ nop; // scope 0 at $DIR/simplify_try.rs:6:13: 6:15
51+
+ nop; // scope 0 at $DIR/simplify_try.rs:6:13: 6:14
52+
+ _0 = _1; // scope 0 at $DIR/simplify_try.rs:6:13: 6:14
53+
+ nop; // scope 6 at $SRC_DIR/libcore/result.rs:LL:COL
54+
+ nop; // scope 0 at $DIR/simplify_try.rs:6:14: 6:15
55+
+ _5 = discriminant(_0); // scope 0 at $DIR/simplify_try.rs:6:14: 6:15
56+
goto -> bb1; // scope 0 at $DIR/simplify_try.rs:6:14: 6:15
57+
}
58+
59+
bb1: {
60+
- _0 = move _3; // scope 1 at $DIR/simplify_try.rs:7:5: 7:10
61+
- StorageDead(_3); // scope 0 at $DIR/simplify_try.rs:6:15: 6:16
62+
+ nop; // scope 1 at $DIR/simplify_try.rs:7:5: 7:10
63+
+ nop; // scope 0 at $DIR/simplify_try.rs:6:15: 6:16
64+
StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:8:1: 8:2
65+
goto -> bb2; // scope 0 at $DIR/simplify_try.rs:8:2: 8:2
66+
}
67+
68+
bb2: {
69+
return; // scope 0 at $DIR/simplify_try.rs:8:2: 8:2
70+
}
71+
}
72+

src/test/mir-opt/simplify_try/rustc.try_identity.SimplifyLocals.after.mir

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ fn try_identity(_1: std::result::Result<u32, i32>) -> std::result::Result<u32, i
2828
}
2929
}
3030
scope 6 {
31-
debug self => _1; // in scope 6 at $SRC_DIR/libcore/result.rs:LL:COL
31+
debug self => _0; // in scope 6 at $SRC_DIR/libcore/result.rs:LL:COL
3232
}
3333

3434
bb0: {
3535
StorageLive(_2); // scope 0 at $DIR/simplify_try.rs:6:9: 6:10
36-
_0 = move _1; // scope 1 at $DIR/simplify_try.rs:7:5: 7:10
36+
_0 = _1; // scope 0 at $DIR/simplify_try.rs:6:13: 6:14
3737
StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:8:1: 8:2
3838
return; // scope 0 at $DIR/simplify_try.rs:8:2: 8:2
3939
}

0 commit comments

Comments
 (0)