Skip to content

Instantly share code, notes, and snippets.

@oyvindln
Created May 11, 2017 13:54
Show Gist options
  • Save oyvindln/2c868587133cc18ae7166a5fd0f5207c to your computer and use it in GitHub Desktop.
Save oyvindln/2c868587133cc18ae7166a5fd0f5207c to your computer and use it in GitHub Desktop.
Copy propagation
DEBUG:rustc_mir::transform::inline: Inline cost for DefId { krate: CrateNum(5), node: DefIndex(145)DEBUG:rustc_metadata::decoder: def_path(id=DefIndex(145))
DEBUG:rustc::hir::map::definitions: DefPath::make: krate=CrateNum(5) index=Some(DefIndex(145))
DEBUG:rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: Some(DefIndex(143)), disambiguated_data: DisambiguatedDefPathData { data: ValueNs("new"), disambiguator: 0 } }
DEBUG:rustc::hir::map::definitions: DefPath::make: krate=CrateNum(5) index=Some(DefIndex(143))
DEBUG:rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: Some(DefIndex(66)), disambiguated_data: DisambiguatedDefPathData { data: Impl, disambiguator: 6 } }
DEBUG:rustc::hir::map::definitions: DefPath::make: krate=CrateNum(5) index=Some(DefIndex(66))
DEBUG:rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: Some(DefIndex(0)), disambiguated_data: DisambiguatedDefPathData { data: Module("boxed"), disambiguator: 0 } }
DEBUG:rustc::hir::map::definitions: DefPath::make: krate=CrateNum(5) index=Some(DefIndex(0))
DEBUG:rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: None, disambiguated_data: DisambiguatedDefPathData { data: CrateRoot, disambiguator: 0 } }
=> alloc/866e2215351f24c9787a2a2c5fcc3bf2::boxed[0]::{{impl}}[6]::new[0] } is 81
DEBUG:rustc::ty::fold: HasTypeFlagsVisitor: t=T t.flags=401 self.flags=23
DEBUG:rustc::ty::subst: shift_regions(ty=[u16; 100], region_binders_passed=0, has_escaping_regions=false)
DEBUG:rustc::ty::fold: HasTypeFlagsVisitor: t=std::boxed::Box<T> t.flags=401 self.flags=23
DEBUG:rustc::ty::fold: HasTypeFlagsVisitor: t=T t.flags=401 self.flags=23
DEBUG:rustc::ty::subst: shift_regions(ty=[u16; 100], region_binders_passed=0, has_escaping_regions=false)
DEBUG:rustc::ty::fold: HasTypeFlagsVisitor: t=std::boxed::Box<T> t.flags=401 self.flags=23
DEBUG:rustc::ty::fold: HasTypeFlagsVisitor: t=T t.flags=401 self.flags=23
DEBUG:rustc::ty::subst: shift_regions(ty=[u16; 100], region_binders_passed=0, has_escaping_regions=false)
DEBUG:rustc::ty::fold: HasTypeFlagsVisitor: t=T t.flags=401 self.flags=23
DEBUG:rustc::ty::subst: shift_regions(ty=[u16; 100], region_binders_passed=0, has_escaping_regions=false)
DEBUG:rustc::ty::fold: HasTypeFlagsVisitor: t=T t.flags=401 self.flags=23
DEBUG:rustc::ty::subst: shift_regions(ty=[u16; 100], region_binders_passed=0, has_escaping_regions=false)
DEBUG:rustc::ty::fold: HasTypeFlagsVisitor: t=std::boxed::Box<T> t.flags=401 self.flags=23
DEBUG:rustc::ty::fold: HasTypeFlagsVisitor: t=T t.flags=401 self.flags=23
DEBUG:rustc::ty::subst: shift_regions(ty=[u16; 100], region_binders_passed=0, has_escaping_regions=false)
DEBUG:rustc::ty::fold: HasTypeFlagsVisitor: t=T t.flags=401 self.flags=23
DEBUG:rustc::ty::subst: shift_regions(ty=[u16; 100], region_binders_passed=0, has_escaping_regions=false)
DEBUG:rustc_mir::transform::inline: Inlined DefId { krate: CrateNum(5), node: DefIndex(145)DEBUG:rustc_metadata::decoder: def_path(id=DefIndex(145))
DEBUG:rustc::hir::map::definitions: DefPath::make: krate=CrateNum(5) index=Some(DefIndex(145))
DEBUG:rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: Some(DefIndex(143)), disambiguated_data: DisambiguatedDefPathData { data: ValueNs("new"), disambiguator: 0 } }
DEBUG:rustc::hir::map::definitions: DefPath::make: krate=CrateNum(5) index=Some(DefIndex(143))
DEBUG:rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: Some(DefIndex(66)), disambiguated_data: DisambiguatedDefPathData { data: Impl, disambiguator: 6 } }
DEBUG:rustc::hir::map::definitions: DefPath::make: krate=CrateNum(5) index=Some(DefIndex(66))
DEBUG:rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: Some(DefIndex(0)), disambiguated_data: DisambiguatedDefPathData { data: Module("boxed"), disambiguator: 0 } }
DEBUG:rustc::hir::map::definitions: DefPath::make: krate=CrateNum(5) index=Some(DefIndex(0))
DEBUG:rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: None, disambiguated_data: DisambiguatedDefPathData { data: CrateRoot, disambiguator: 0 } }
=> alloc/866e2215351f24c9787a2a2c5fcc3bf2::boxed[0]::{{impl}}[6]::new[0] } into DefId { krate: CrateNum(0), node: DefIndex(3)DEBUG:rustc::hir::map::definitions: DefPath::make: krate=CrateNum(0) index=Some(DefIndex(3))
DEBUG:rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: Some(DefIndex(0)), disambiguated_data: DisambiguatedDefPathData { data: ValueNs("create_boxed_array"), disambiguator: 0 } }
DEBUG:rustc::hir::map::definitions: DefPath::make: krate=CrateNum(0) index=Some(DefIndex(0))
DEBUG:rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: None, disambiguated_data: DisambiguatedDefPathData { data: CrateRoot, disambiguator: 0 } }
=> test/4089d7c8b778d88cec885baf7b69e6df::create_boxed_array[0] }
DEBUG:rustc_mir::transform::inline: Running simplify cfg on DefId { krate: CrateNum(0), node: DefIndex(3)DEBUG:rustc::hir::map::definitions: DefPath::make: krate=CrateNum(0) index=Some(DefIndex(3))
DEBUG:rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: Some(DefIndex(0)), disambiguated_data: DisambiguatedDefPathData { data: ValueNs("create_boxed_array"), disambiguator: 0 } }
DEBUG:rustc::hir::map::definitions: DefPath::make: krate=CrateNum(0) index=Some(DefIndex(0))
DEBUG:rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: None, disambiguated_data: DisambiguatedDefPathData { data: CrateRoot, disambiguator: 0 } }
=> test/4089d7c8b778d88cec885baf7b69e6df::create_boxed_array[0] }
DEBUG:rustc_mir::transform::simplify: simplifying bb0
DEBUG:rustc_mir::transform::simplify: merging block bb2 into Terminator { source_info: SourceInfo { span: DEBUG:syntax::codemap: byte pos BytePos(103) is on the line at byte pos BytePos(99)
DEBUG:syntax::codemap: char pos CharPos(103) is on the line at char pos CharPos(99)
DEBUG:syntax::codemap: byte is on line: 5
DEBUG:syntax::codemap: byte pos BytePos(126) is on the line at byte pos BytePos(99)
DEBUG:syntax::codemap: char pos CharPos(126) is on the line at char pos CharPos(99)
DEBUG:syntax::codemap: byte is on line: 5
/home/oln/programmering/rust/projects/alloc_test/test.rs:5:5: 5:28, scope: scope0 }, kind: goto -> bb2 }
DEBUG:rustc_mir::transform::simplify: merging block bb1 into Terminator { source_info: SourceInfo { span: DEBUG:syntax::codemap: byte pos BytePos(20003) is on the line at byte pos BytePos(19998)
DEBUG:syntax::codemap: char pos CharPos(7123) is on the line at char pos CharPos(7118)
DEBUG:syntax::codemap: byte is on line: 239
DEBUG:syntax::codemap: byte pos BytePos(20003) is on the line at byte pos BytePos(19998)
DEBUG:syntax::codemap: char pos CharPos(7123) is on the line at char pos CharPos(7118)
DEBUG:syntax::codemap: byte is on line: 239
src/liballoc/boxed.rs:239:6: 239:6, scope: scope2 }, kind: goto -> bb1 }
DEBUG:rustc_mir::transform::simplify: simplifying bb0
DEBUG:rustc_mir::transform::deaggregator: running on: "create_boxed_array::{{initializer}}"
DEBUG:rustc_mir::transform::deaggregator: running on: "create_boxed_array::{{initializer}}"
DEBUG:rustc_mir::transform::deaggregator: running on: "create_boxed_array"
DEBUG:rustc_mir::transform::copy_prop: Considering destination local: _0
DEBUG:rustc_mir::transform::copy_prop: Can't copy-propagate local: dest _0 unused
DEBUG:rustc_mir::transform::copy_prop: Considering destination local: _1
DEBUG:rustc_mir::transform::copy_prop: Can't copy-propagate local: source use is not an assignment
DEBUG:rustc_mir::transform::copy_prop: Considering destination local: _2
DEBUG:rustc_mir::transform::copy_prop: Replacing all uses of _2 with _1 (local)
DEBUG:rustc_mir::transform::copy_prop: Deleting assignment
DEBUG:rustc_mir::transform::copy_prop: Considering destination local: _0
DEBUG:rustc_mir::transform::copy_prop: Can't copy-propagate local: dest _0 unused
DEBUG:rustc_mir::transform::copy_prop: Considering destination local: _1
DEBUG:rustc_mir::transform::copy_prop: Can't copy-propagate local: source use is not an assignment
DEBUG:rustc_mir::transform::copy_prop: Considering destination local: _2
DEBUG:rustc_mir::transform::copy_prop: Can't copy-propagate local: dest _2 undefined
DEBUG:rustc_mir::transform::copy_prop: Considering destination local: _3
DEBUG:rustc_mir::transform::copy_prop: Can't copy-propagate local: dest _3 defined 2 times
DEBUG:rustc_mir::transform::copy_prop: Considering destination local: _4
DEBUG:rustc_mir::transform::copy_prop: Replacing all uses of _4 with _1 (local)
DEBUG:rustc_mir::transform::copy_prop: Deleting assignment
DEBUG:rustc_mir::transform::copy_prop: Considering destination local: _0
DEBUG:rustc_mir::transform::copy_prop: Can't copy-propagate local: dest _0 unused
DEBUG:rustc_mir::transform::copy_prop: Considering destination local: _1
DEBUG:rustc_mir::transform::copy_prop: Can't copy-propagate local: source use is not an assignment
DEBUG:rustc_mir::transform::copy_prop: Considering destination local: _2
DEBUG:rustc_mir::transform::copy_prop: Can't copy-propagate local: dest _2 undefined
DEBUG:rustc_mir::transform::copy_prop: Considering destination local: _3
DEBUG:rustc_mir::transform::copy_prop: Can't copy-propagate local: dest _3 defined 2 times
DEBUG:rustc_mir::transform::copy_prop: Considering destination local: _4
DEBUG:rustc_mir::transform::copy_prop: Can't copy-propagate local: dest _4 undefined
// MIR for `create_boxed_array`
// source = Fn(NodeId(4))
// pass_name = CopyPropagation
// disambiguator = after
fn create_boxed_array() -> std::boxed::Box<[u16; 100]> {
let mut _0: std::boxed::Box<[u16; 100]>; // return pointer
scope 1 {
}
scope 2 {
let _2: [u16; 100]; // "x" in scope 2 at test.rs:5:5: 5:28
}
let mut _1: [u16; 100];
let mut _3: std::boxed::Box<[u16; 100]>;
let mut _4: [u16; 100];
bb0: {
nop; // scope 0 at test.rs:5:14: 5:27
_1 = [const 100u16; Us64(100)]; // scope 0 at test.rs:5:14: 5:27
nop; // scope 1 at /checkout/src/liballoc/boxed.rs:238:16: 238:17
nop; // scope 1 at /checkout/src/liballoc/boxed.rs:238:16: 238:17
_3 = Box([u16; 100]); // scope 2 at /checkout/src/liballoc/boxed.rs:239:9: 239:14
nop; // scope 2 at /checkout/src/liballoc/boxed.rs:239:13: 239:14
nop; // scope 2 at /checkout/src/liballoc/boxed.rs:239:13: 239:14
(*_3) = _1; // scope 2 at /checkout/src/liballoc/boxed.rs:239:13: 239:14
nop; // scope 2 at /checkout/src/liballoc/boxed.rs:239:14: 239:14
_0 = _3; // scope 2 at /checkout/src/liballoc/boxed.rs:239:9: 239:14
nop; // scope 1 at /checkout/src/liballoc/boxed.rs:240:6: 240:6
nop; // scope 0 at test.rs:5:28: 5:28
return; // scope 0 at test.rs:6:2: 6:2
}
}
// MIR for `create_boxed_array`
// source = Fn(NodeId(4))
// pass_name = CopyPropagation
// disambiguator = before
fn create_boxed_array() -> std::boxed::Box<[u16; 100]> {
let mut _0: std::boxed::Box<[u16; 100]>; // return pointer
scope 1 {
}
scope 2 {
let _2: [u16; 100]; // "x" in scope 2 at test.rs:5:5: 5:28
}
let mut _1: [u16; 100];
let mut _3: std::boxed::Box<[u16; 100]>;
let mut _4: [u16; 100];
bb0: {
StorageLive(_1); // scope 0 at test.rs:5:14: 5:27
_1 = [const 100u16; Us64(100)]; // scope 0 at test.rs:5:14: 5:27
StorageLive(_2); // scope 1 at /checkout/src/liballoc/boxed.rs:238:16: 238:17
_2 = _1; // scope 1 at /checkout/src/liballoc/boxed.rs:238:16: 238:17
_3 = Box([u16; 100]); // scope 2 at /checkout/src/liballoc/boxed.rs:239:9: 239:14
StorageLive(_4); // scope 2 at /checkout/src/liballoc/boxed.rs:239:13: 239:14
_4 = _2; // scope 2 at /checkout/src/liballoc/boxed.rs:239:13: 239:14
(*_3) = _4; // scope 2 at /checkout/src/liballoc/boxed.rs:239:13: 239:14
StorageDead(_4); // scope 2 at /checkout/src/liballoc/boxed.rs:239:14: 239:14
_0 = _3; // scope 2 at /checkout/src/liballoc/boxed.rs:239:9: 239:14
StorageDead(_2); // scope 1 at /checkout/src/liballoc/boxed.rs:240:6: 240:6
StorageDead(_1); // scope 0 at test.rs:5:28: 5:28
return; // scope 0 at test.rs:6:2: 6:2
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment