Stop optimizing promoteds
This commit is contained in:
parent
9a22f993f0
commit
68ff5f0a18
8 changed files with 70 additions and 71 deletions
|
@ -510,7 +510,6 @@ fn promoted_mir<'tcx>(
|
||||||
|
|
||||||
for body in &mut promoted {
|
for body in &mut promoted {
|
||||||
run_post_borrowck_cleanup_passes(tcx, body);
|
run_post_borrowck_cleanup_passes(tcx, body);
|
||||||
run_optimization_passes(tcx, body);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
debug_assert!(!promoted.has_free_regions(), "Free regions in promoted MIR");
|
debug_assert!(!promoted.has_free_regions(), "Free regions in promoted MIR");
|
||||||
|
|
|
@ -5,11 +5,11 @@ extern "C" {
|
||||||
static Y: i32 = 42;
|
static Y: i32 = 42;
|
||||||
|
|
||||||
// EMIT_MIR const_promotion_extern_static.BAR.PromoteTemps.diff
|
// EMIT_MIR const_promotion_extern_static.BAR.PromoteTemps.diff
|
||||||
// EMIT_MIR const_promotion_extern_static.BAR-promoted[0].ConstProp.after.mir
|
// EMIT_MIR const_promotion_extern_static.BAR-promoted[0].SimplifyCfg-elaborate-drops.after.mir
|
||||||
static mut BAR: *const &i32 = [&Y].as_ptr();
|
static mut BAR: *const &i32 = [&Y].as_ptr();
|
||||||
|
|
||||||
// EMIT_MIR const_promotion_extern_static.FOO.PromoteTemps.diff
|
// EMIT_MIR const_promotion_extern_static.FOO.PromoteTemps.diff
|
||||||
// EMIT_MIR const_promotion_extern_static.FOO-promoted[0].ConstProp.after.mir
|
// EMIT_MIR const_promotion_extern_static.FOO-promoted[0].SimplifyCfg-elaborate-drops.after.mir
|
||||||
static mut FOO: *const &i32 = [unsafe { &X }].as_ptr();
|
static mut FOO: *const &i32 = [unsafe { &X }].as_ptr();
|
||||||
|
|
||||||
// EMIT_MIR const_promotion_extern_static.BOP.mir_map.0.mir
|
// EMIT_MIR const_promotion_extern_static.BOP.mir_map.0.mir
|
||||||
|
|
|
@ -24,42 +24,42 @@ fn main() -> () {
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc0 (static: FOO, size: 8, align: 4) {
|
alloc0 (static: FOO, size: 8, align: 4) {
|
||||||
╾─alloc14─╼ 03 00 00 00 │ ╾──╼....
|
╾─alloc17─╼ 03 00 00 00 │ ╾──╼....
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc14 (size: 48, align: 4) {
|
alloc17 (size: 48, align: 4) {
|
||||||
0x00 │ 00 00 00 00 __ __ __ __ ╾─alloc4──╼ 00 00 00 00 │ ....░░░░╾──╼....
|
0x00 │ 00 00 00 00 __ __ __ __ ╾─alloc4──╼ 00 00 00 00 │ ....░░░░╾──╼....
|
||||||
0x10 │ 00 00 00 00 __ __ __ __ ╾─alloc7──╼ 02 00 00 00 │ ....░░░░╾──╼....
|
0x10 │ 00 00 00 00 __ __ __ __ ╾─alloc8──╼ 02 00 00 00 │ ....░░░░╾──╼....
|
||||||
0x20 │ 01 00 00 00 2a 00 00 00 ╾─alloc11─╼ 03 00 00 00 │ ....*...╾──╼....
|
0x20 │ 01 00 00 00 2a 00 00 00 ╾─alloc13─╼ 03 00 00 00 │ ....*...╾──╼....
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc4 (size: 0, align: 4) {}
|
alloc4 (size: 0, align: 4) {}
|
||||||
|
|
||||||
alloc7 (size: 16, align: 4) {
|
alloc8 (size: 16, align: 4) {
|
||||||
╾─alloc6──╼ 03 00 00 00 ╾─alloc8──╼ 03 00 00 00 │ ╾──╼....╾──╼....
|
╾─alloc7──╼ 03 00 00 00 ╾─alloc9──╼ 03 00 00 00 │ ╾──╼....╾──╼....
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc6 (size: 3, align: 1) {
|
alloc7 (size: 3, align: 1) {
|
||||||
66 6f 6f │ foo
|
66 6f 6f │ foo
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc8 (size: 3, align: 1) {
|
alloc9 (size: 3, align: 1) {
|
||||||
62 61 72 │ bar
|
62 61 72 │ bar
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc11 (size: 24, align: 4) {
|
alloc13 (size: 24, align: 4) {
|
||||||
0x00 │ ╾─alloc10─╼ 03 00 00 00 ╾─alloc12─╼ 03 00 00 00 │ ╾──╼....╾──╼....
|
0x00 │ ╾─alloc12─╼ 03 00 00 00 ╾─alloc14─╼ 03 00 00 00 │ ╾──╼....╾──╼....
|
||||||
0x10 │ ╾─alloc13─╼ 04 00 00 00 │ ╾──╼....
|
0x10 │ ╾─alloc15─╼ 04 00 00 00 │ ╾──╼....
|
||||||
}
|
|
||||||
|
|
||||||
alloc10 (size: 3, align: 1) {
|
|
||||||
6d 65 68 │ meh
|
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc12 (size: 3, align: 1) {
|
alloc12 (size: 3, align: 1) {
|
||||||
|
6d 65 68 │ meh
|
||||||
|
}
|
||||||
|
|
||||||
|
alloc14 (size: 3, align: 1) {
|
||||||
6d 6f 70 │ mop
|
6d 6f 70 │ mop
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc13 (size: 4, align: 1) {
|
alloc15 (size: 4, align: 1) {
|
||||||
6d c3 b6 70 │ m..p
|
6d c3 b6 70 │ m..p
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,46 +24,46 @@ fn main() -> () {
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc0 (static: FOO, size: 16, align: 8) {
|
alloc0 (static: FOO, size: 16, align: 8) {
|
||||||
╾───────alloc14───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
|
╾───────alloc17───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc14 (size: 72, align: 8) {
|
alloc17 (size: 72, align: 8) {
|
||||||
0x00 │ 00 00 00 00 __ __ __ __ ╾───────alloc4────────╼ │ ....░░░░╾──────╼
|
0x00 │ 00 00 00 00 __ __ __ __ ╾───────alloc4────────╼ │ ....░░░░╾──────╼
|
||||||
0x10 │ 00 00 00 00 00 00 00 00 00 00 00 00 __ __ __ __ │ ............░░░░
|
0x10 │ 00 00 00 00 00 00 00 00 00 00 00 00 __ __ __ __ │ ............░░░░
|
||||||
0x20 │ ╾───────alloc7────────╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........
|
0x20 │ ╾───────alloc8────────╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||||
0x30 │ 01 00 00 00 2a 00 00 00 ╾───────alloc11───────╼ │ ....*...╾──────╼
|
0x30 │ 01 00 00 00 2a 00 00 00 ╾───────alloc13───────╼ │ ....*...╾──────╼
|
||||||
0x40 │ 03 00 00 00 00 00 00 00 │ ........
|
0x40 │ 03 00 00 00 00 00 00 00 │ ........
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc4 (size: 0, align: 8) {}
|
alloc4 (size: 0, align: 8) {}
|
||||||
|
|
||||||
alloc7 (size: 32, align: 8) {
|
alloc8 (size: 32, align: 8) {
|
||||||
0x00 │ ╾───────alloc6────────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
|
0x00 │ ╾───────alloc7────────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||||
0x10 │ ╾───────alloc8────────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
|
0x10 │ ╾───────alloc9────────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc6 (size: 3, align: 1) {
|
alloc7 (size: 3, align: 1) {
|
||||||
66 6f 6f │ foo
|
66 6f 6f │ foo
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc8 (size: 3, align: 1) {
|
alloc9 (size: 3, align: 1) {
|
||||||
62 61 72 │ bar
|
62 61 72 │ bar
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc11 (size: 48, align: 8) {
|
alloc13 (size: 48, align: 8) {
|
||||||
0x00 │ ╾───────alloc10───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
|
0x00 │ ╾───────alloc12───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||||
0x10 │ ╾───────alloc12───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
|
0x10 │ ╾───────alloc14───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||||
0x20 │ ╾───────alloc13───────╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........
|
0x20 │ ╾───────alloc15───────╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||||
}
|
|
||||||
|
|
||||||
alloc10 (size: 3, align: 1) {
|
|
||||||
6d 65 68 │ meh
|
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc12 (size: 3, align: 1) {
|
alloc12 (size: 3, align: 1) {
|
||||||
|
6d 65 68 │ meh
|
||||||
|
}
|
||||||
|
|
||||||
|
alloc14 (size: 3, align: 1) {
|
||||||
6d 6f 70 │ mop
|
6d 6f 70 │ mop
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc13 (size: 4, align: 1) {
|
alloc15 (size: 4, align: 1) {
|
||||||
6d c3 b6 70 │ m..p
|
6d c3 b6 70 │ m..p
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,41 +24,41 @@ fn main() -> () {
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc0 (static: FOO, size: 8, align: 4) {
|
alloc0 (static: FOO, size: 8, align: 4) {
|
||||||
╾─alloc20─╼ 03 00 00 00 │ ╾──╼....
|
╾─alloc23─╼ 03 00 00 00 │ ╾──╼....
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc20 (size: 48, align: 4) {
|
alloc23 (size: 48, align: 4) {
|
||||||
0x00 │ 00 00 00 00 __ __ __ __ ╾─alloc8──╼ 00 00 00 00 │ ....░░░░╾──╼....
|
0x00 │ 00 00 00 00 __ __ __ __ ╾─alloc8──╼ 00 00 00 00 │ ....░░░░╾──╼....
|
||||||
0x10 │ 00 00 00 00 __ __ __ __ ╾─alloc12─╼ 02 00 00 00 │ ....░░░░╾──╼....
|
0x10 │ 00 00 00 00 __ __ __ __ ╾─alloc13─╼ 02 00 00 00 │ ....░░░░╾──╼....
|
||||||
0x20 │ 01 00 00 00 2a 00 00 00 ╾─alloc19─╼ 03 00 00 00 │ ....*...╾──╼....
|
0x20 │ 01 00 00 00 2a 00 00 00 ╾─alloc21─╼ 03 00 00 00 │ ....*...╾──╼....
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc8 (size: 0, align: 4) {}
|
alloc8 (size: 0, align: 4) {}
|
||||||
|
|
||||||
alloc12 (size: 8, align: 4) {
|
alloc13 (size: 8, align: 4) {
|
||||||
╾─alloc10─╼ ╾─alloc11─╼ │ ╾──╼╾──╼
|
╾─alloc11─╼ ╾─alloc12─╼ │ ╾──╼╾──╼
|
||||||
}
|
|
||||||
|
|
||||||
alloc10 (size: 1, align: 1) {
|
|
||||||
05 │ .
|
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc11 (size: 1, align: 1) {
|
alloc11 (size: 1, align: 1) {
|
||||||
|
05 │ .
|
||||||
|
}
|
||||||
|
|
||||||
|
alloc12 (size: 1, align: 1) {
|
||||||
06 │ .
|
06 │ .
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc19 (size: 12, align: 4) {
|
alloc21 (size: 12, align: 4) {
|
||||||
╾─a15+0x3─╼ ╾─alloc16─╼ ╾─a18+0x2─╼ │ ╾──╼╾──╼╾──╼
|
╾─a17+0x3─╼ ╾─alloc18─╼ ╾─a20+0x2─╼ │ ╾──╼╾──╼╾──╼
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc15 (size: 4, align: 1) {
|
alloc17 (size: 4, align: 1) {
|
||||||
2a 45 15 6f │ *E.o
|
2a 45 15 6f │ *E.o
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc16 (size: 1, align: 1) {
|
alloc18 (size: 1, align: 1) {
|
||||||
2a │ *
|
2a │ *
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc18 (size: 4, align: 1) {
|
alloc20 (size: 4, align: 1) {
|
||||||
2a 45 15 6f │ *E.o
|
2a 45 15 6f │ *E.o
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,44 +24,44 @@ fn main() -> () {
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc0 (static: FOO, size: 16, align: 8) {
|
alloc0 (static: FOO, size: 16, align: 8) {
|
||||||
╾───────alloc20───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
|
╾───────alloc23───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc20 (size: 72, align: 8) {
|
alloc23 (size: 72, align: 8) {
|
||||||
0x00 │ 00 00 00 00 __ __ __ __ ╾───────alloc8────────╼ │ ....░░░░╾──────╼
|
0x00 │ 00 00 00 00 __ __ __ __ ╾───────alloc8────────╼ │ ....░░░░╾──────╼
|
||||||
0x10 │ 00 00 00 00 00 00 00 00 00 00 00 00 __ __ __ __ │ ............░░░░
|
0x10 │ 00 00 00 00 00 00 00 00 00 00 00 00 __ __ __ __ │ ............░░░░
|
||||||
0x20 │ ╾───────alloc12───────╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........
|
0x20 │ ╾───────alloc13───────╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||||
0x30 │ 01 00 00 00 2a 00 00 00 ╾───────alloc19───────╼ │ ....*...╾──────╼
|
0x30 │ 01 00 00 00 2a 00 00 00 ╾───────alloc21───────╼ │ ....*...╾──────╼
|
||||||
0x40 │ 03 00 00 00 00 00 00 00 │ ........
|
0x40 │ 03 00 00 00 00 00 00 00 │ ........
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc8 (size: 0, align: 8) {}
|
alloc8 (size: 0, align: 8) {}
|
||||||
|
|
||||||
alloc12 (size: 16, align: 8) {
|
alloc13 (size: 16, align: 8) {
|
||||||
╾───────alloc10───────╼ ╾───────alloc11───────╼ │ ╾──────╼╾──────╼
|
╾───────alloc11───────╼ ╾───────alloc12───────╼ │ ╾──────╼╾──────╼
|
||||||
}
|
|
||||||
|
|
||||||
alloc10 (size: 1, align: 1) {
|
|
||||||
05 │ .
|
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc11 (size: 1, align: 1) {
|
alloc11 (size: 1, align: 1) {
|
||||||
|
05 │ .
|
||||||
|
}
|
||||||
|
|
||||||
|
alloc12 (size: 1, align: 1) {
|
||||||
06 │ .
|
06 │ .
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc19 (size: 24, align: 8) {
|
alloc21 (size: 24, align: 8) {
|
||||||
0x00 │ ╾─────alloc15+0x3─────╼ ╾───────alloc16───────╼ │ ╾──────╼╾──────╼
|
0x00 │ ╾─────alloc17+0x3─────╼ ╾───────alloc18───────╼ │ ╾──────╼╾──────╼
|
||||||
0x10 │ ╾─────alloc18+0x2─────╼ │ ╾──────╼
|
0x10 │ ╾─────alloc20+0x2─────╼ │ ╾──────╼
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc15 (size: 4, align: 1) {
|
alloc17 (size: 4, align: 1) {
|
||||||
2a 45 15 6f │ *E.o
|
2a 45 15 6f │ *E.o
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc16 (size: 1, align: 1) {
|
alloc18 (size: 1, align: 1) {
|
||||||
2a │ *
|
2a │ *
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc18 (size: 4, align: 1) {
|
alloc20 (size: 4, align: 1) {
|
||||||
2a 45 15 6f │ *E.o
|
2a 45 15 6f │ *E.o
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// MIR for `BAR::promoted[0]` after ConstProp
|
// MIR for `BAR::promoted[0]` after SimplifyCfg-elaborate-drops
|
||||||
|
|
||||||
promoted[0] in BAR: &[&i32; 1] = {
|
promoted[0] in BAR: &[&i32; 1] = {
|
||||||
let mut _0: &[&i32; 1]; // return place in scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
let mut _0: &[&i32; 1]; // return place in scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
||||||
|
@ -14,7 +14,7 @@ promoted[0] in BAR: &[&i32; 1] = {
|
||||||
// mir::Constant
|
// mir::Constant
|
||||||
// + span: $DIR/const-promotion-extern-static.rs:9:33: 9:34
|
// + span: $DIR/const-promotion-extern-static.rs:9:33: 9:34
|
||||||
// + literal: Const { ty: &i32, val: Value(Scalar(alloc0)) }
|
// + literal: Const { ty: &i32, val: Value(Scalar(alloc0)) }
|
||||||
_2 = _3; // scope 0 at $DIR/const-promotion-extern-static.rs:9:32: 9:34
|
_2 = &(*_3); // scope 0 at $DIR/const-promotion-extern-static.rs:9:32: 9:34
|
||||||
_1 = [move _2]; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
_1 = [move _2]; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
||||||
_0 = &_1; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
_0 = &_1; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
||||||
return; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
return; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
|
@ -1,4 +1,4 @@
|
||||||
// MIR for `FOO::promoted[0]` after ConstProp
|
// MIR for `FOO::promoted[0]` after SimplifyCfg-elaborate-drops
|
||||||
|
|
||||||
promoted[0] in FOO: &[&i32; 1] = {
|
promoted[0] in FOO: &[&i32; 1] = {
|
||||||
let mut _0: &[&i32; 1]; // return place in scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
let mut _0: &[&i32; 1]; // return place in scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
Loading…
Add table
Add a link
Reference in a new issue