Skip to content

Instantly share code, notes, and snippets.

@bluss
Last active December 10, 2016 20:25
Show Gist options
  • Save bluss/be12cd8bc86929db3325399d27a2442f to your computer and use it in GitHub Desktop.
Save bluss/be12cd8bc86929db3325399d27a2442f to your computer and use it in GitHub Desktop.
// MIR for `id_option`
// node_id = 4
// pass_name = CopyPropagation
// disambiguator = after
fn id_option(_1: std::option::Option<u32>) -> std::option::Option<u32> {
let mut _0: std::option::Option<u32>; // return pointer
scope 1 {
let _2: std::option::Option<u32>; // "a" in scope 1 at id.rs:6:18: 6:19
scope 2 {
let _3: u32; // "x" in scope 2 at id.rs:8:14: 8:15
}
}
let mut _4: u32;
bb0: {
StorageLive(_2); // scope 0 at id.rs:6:18: 6:19
_2 = _1; // scope 0 at id.rs:6:18: 6:19
switch(_2) -> [None: bb1, Some: bb2]; // scope 1 at id.rs:8:9: 8:16
}
bb1: {
_0 = std::option::Option<u32>::None; // scope 1 at id.rs:9:17: 9:21
goto -> bb3; // scope 1 at id.rs:7:5: 10:6
}
bb2: {
nop; // scope 1 at id.rs:8:14: 8:15
nop; // scope 1 at id.rs:8:14: 8:15
nop; // scope 2 at id.rs:8:25: 8:26
nop; // scope 2 at id.rs:8:25: 8:26
_0 = _2; // scope 2 at id.rs:8:20: 8:27
nop; // scope 2 at id.rs:8:27: 8:27
goto -> bb3; // scope 1 at id.rs:7:5: 10:6
}
bb3: {
nop; // scope 1 at id.rs:10:6: 10:6
StorageDead(_2); // scope 0 at id.rs:11:2: 11:2
return; // scope 1 at id.rs:11:2: 11:2
}
}
// MIR for `id_option`
// node_id = 4
// pass_name = CopyPropagation
// disambiguator = before
fn id_option(_1: std::option::Option<u32>) -> std::option::Option<u32> {
let mut _0: std::option::Option<u32>; // return pointer
scope 1 {
let _2: std::option::Option<u32>; // "a" in scope 1 at id.rs:6:18: 6:19
scope 2 {
let _3: u32; // "x" in scope 2 at id.rs:8:14: 8:15
}
}
let mut _4: u32;
bb0: {
StorageLive(_2); // scope 0 at id.rs:6:18: 6:19
_2 = _1; // scope 0 at id.rs:6:18: 6:19
switch(_2) -> [None: bb1, Some: bb2]; // scope 1 at id.rs:8:9: 8:16
}
bb1: {
_0 = std::option::Option<u32>::None; // scope 1 at id.rs:9:17: 9:21
goto -> bb3; // scope 1 at id.rs:7:5: 10:6
}
bb2: {
StorageLive(_3); // scope 1 at id.rs:8:14: 8:15
_3 = ((_2 as Some).0: u32); // scope 1 at id.rs:8:14: 8:15
StorageLive(_4); // scope 2 at id.rs:8:25: 8:26
_4 = _3; // scope 2 at id.rs:8:25: 8:26
_0 = std::option::Option<u32>::Some(_4,); // scope 2 at id.rs:8:20: 8:27
StorageDead(_4); // scope 2 at id.rs:8:27: 8:27
goto -> bb3; // scope 1 at id.rs:7:5: 10:6
}
bb3: {
StorageDead(_3); // scope 1 at id.rs:10:6: 10:6
StorageDead(_2); // scope 0 at id.rs:11:2: 11:2
return; // scope 1 at id.rs:11:2: 11:2
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment