mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Remove copy of current const prop tests and add a few new tests
This commit is contained in:
parent
1f82a9f89e
commit
da4a40f816
@ -1,5 +1,5 @@
|
||||
// unit-test: DataflowConstProp
|
||||
// compile-flags: -C overflow-checks=on
|
||||
// compile-flags: -Zunsound-mir-opts -Coverflow-checks=on
|
||||
|
||||
// EMIT_MIR checked.main.DataflowConstProp.diff
|
||||
#[allow(arithmetic_overflow)]
|
||||
|
@ -2,13 +2,13 @@
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/inherit_overflow_checks_use.rs:+0:11: +0:11
|
||||
let mut _1: u8; // in scope 0 at $DIR/inherit_overflow_checks_use.rs:+3:13: +3:47
|
||||
let mut _2: u8; // in scope 0 at $DIR/inherit_overflow_checks_use.rs:+3:13: +3:47
|
||||
let mut _3: u8; // in scope 0 at $DIR/inherit_overflow_checks_use.rs:+3:13: +3:47
|
||||
let mut _0: (); // return place in scope 0 at $DIR/inherit_overflow.rs:+0:11: +0:11
|
||||
let mut _1: u8; // in scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
|
||||
let mut _2: u8; // in scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
|
||||
let mut _3: u8; // in scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
|
||||
scope 1 {
|
||||
}
|
||||
scope 2 (inlined <u8 as Add>::add) { // at $DIR/inherit_overflow_checks_use.rs:7:13: 7:47
|
||||
scope 2 (inlined <u8 as Add>::add) { // at $DIR/inherit_overflow.rs:7:13: 7:47
|
||||
debug self => _2; // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
||||
debug other => _3; // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
||||
let mut _4: u8; // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
||||
@ -17,11 +17,11 @@
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/inherit_overflow_checks_use.rs:+3:13: +3:47
|
||||
StorageLive(_2); // scope 0 at $DIR/inherit_overflow_checks_use.rs:+3:13: +3:47
|
||||
_2 = const u8::MAX; // scope 0 at $DIR/inherit_overflow_checks_use.rs:+3:13: +3:47
|
||||
StorageLive(_3); // scope 0 at $DIR/inherit_overflow_checks_use.rs:+3:13: +3:47
|
||||
_3 = const 1_u8; // scope 0 at $DIR/inherit_overflow_checks_use.rs:+3:13: +3:47
|
||||
StorageLive(_1); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
|
||||
StorageLive(_2); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
|
||||
_2 = const u8::MAX; // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
|
||||
StorageLive(_3); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
|
||||
_3 = const 1_u8; // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
|
||||
StorageLive(_4); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
||||
_4 = const u8::MAX; // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
||||
StorageLive(_5); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
||||
@ -35,11 +35,11 @@
|
||||
+ _1 = const 0_u8; // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
||||
StorageDead(_5); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
||||
StorageDead(_4); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
||||
StorageDead(_3); // scope 0 at $DIR/inherit_overflow_checks_use.rs:+3:13: +3:47
|
||||
StorageDead(_2); // scope 0 at $DIR/inherit_overflow_checks_use.rs:+3:13: +3:47
|
||||
StorageDead(_1); // scope 0 at $DIR/inherit_overflow_checks_use.rs:+3:47: +3:48
|
||||
nop; // scope 0 at $DIR/inherit_overflow_checks_use.rs:+0:11: +4:2
|
||||
return; // scope 0 at $DIR/inherit_overflow_checks_use.rs:+4:2: +4:2
|
||||
StorageDead(_3); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
|
||||
StorageDead(_2); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
|
||||
StorageDead(_1); // scope 0 at $DIR/inherit_overflow.rs:+3:47: +3:48
|
||||
nop; // scope 0 at $DIR/inherit_overflow.rs:+0:11: +4:2
|
||||
return; // scope 0 at $DIR/inherit_overflow.rs:+4:2: +4:2
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
// compile-flags: -C overflow-checks=off
|
||||
// compile-flags: -Coverflow-checks=off -Zunsound-mir-opts
|
||||
|
||||
// EMIT_MIR inherit_overflow_checks_use.main.DataflowConstProp.diff
|
||||
// EMIT_MIR inherit_overflow.main.DataflowConstProp.diff
|
||||
fn main() {
|
||||
// After inlining, this will contain a `CheckedBinaryOp`. The overflow
|
||||
// must be ignored by the constant propagation to avoid triggering a panic.
|
@ -1,4 +1,5 @@
|
||||
// unit-test: DataflowConstProp
|
||||
// compile-flags: -Zunsound-mir-opts
|
||||
|
||||
// EMIT_MIR issue_81605.f.DataflowConstProp.diff
|
||||
fn f() -> usize {
|
||||
|
@ -1,32 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/aggregate.rs:+0:11: +0:11
|
||||
let _1: i32; // in scope 0 at $DIR/aggregate.rs:+1:9: +1:10
|
||||
let mut _2: i32; // in scope 0 at $DIR/aggregate.rs:+1:13: +1:24
|
||||
let mut _3: (i32, i32, i32); // in scope 0 at $DIR/aggregate.rs:+1:13: +1:22
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/aggregate.rs:+1:9: +1:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/aggregate.rs:+1:9: +1:10
|
||||
StorageLive(_2); // scope 0 at $DIR/aggregate.rs:+1:13: +1:24
|
||||
StorageLive(_3); // scope 0 at $DIR/aggregate.rs:+1:13: +1:22
|
||||
Deinit(_3); // scope 0 at $DIR/aggregate.rs:+1:13: +1:22
|
||||
(_3.0: i32) = const 0_i32; // scope 0 at $DIR/aggregate.rs:+1:13: +1:22
|
||||
(_3.1: i32) = const 1_i32; // scope 0 at $DIR/aggregate.rs:+1:13: +1:22
|
||||
(_3.2: i32) = const 2_i32; // scope 0 at $DIR/aggregate.rs:+1:13: +1:22
|
||||
- _2 = (_3.1: i32); // scope 0 at $DIR/aggregate.rs:+1:13: +1:24
|
||||
- _1 = Add(move _2, const 0_i32); // scope 0 at $DIR/aggregate.rs:+1:13: +1:28
|
||||
+ _2 = const 1_i32; // scope 0 at $DIR/aggregate.rs:+1:13: +1:24
|
||||
+ _1 = const 1_i32; // scope 0 at $DIR/aggregate.rs:+1:13: +1:28
|
||||
StorageDead(_2); // scope 0 at $DIR/aggregate.rs:+1:27: +1:28
|
||||
StorageDead(_3); // scope 0 at $DIR/aggregate.rs:+1:28: +1:29
|
||||
_0 = const (); // scope 0 at $DIR/aggregate.rs:+0:11: +2:2
|
||||
StorageDead(_1); // scope 0 at $DIR/aggregate.rs:+2:1: +2:2
|
||||
return; // scope 0 at $DIR/aggregate.rs:+2:2: +2:2
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +0,0 @@
|
||||
// unit-test: DataflowConstProp
|
||||
// compile-flags: -O
|
||||
|
||||
// EMIT_MIR aggregate.main.DataflowConstProp.diff
|
||||
fn main() {
|
||||
let x = (0, 1, 2).1 + 0;
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/array_index.rs:+0:11: +0:11
|
||||
let _1: u32; // in scope 0 at $DIR/array_index.rs:+1:9: +1:10
|
||||
let mut _2: [u32; 4]; // in scope 0 at $DIR/array_index.rs:+1:18: +1:30
|
||||
let _3: usize; // in scope 0 at $DIR/array_index.rs:+1:31: +1:32
|
||||
let mut _4: usize; // in scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
let mut _5: bool; // in scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/array_index.rs:+1:9: +1:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/array_index.rs:+1:9: +1:10
|
||||
StorageLive(_2); // scope 0 at $DIR/array_index.rs:+1:18: +1:30
|
||||
_2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32]; // scope 0 at $DIR/array_index.rs:+1:18: +1:30
|
||||
StorageLive(_3); // scope 0 at $DIR/array_index.rs:+1:31: +1:32
|
||||
_3 = const 2_usize; // scope 0 at $DIR/array_index.rs:+1:31: +1:32
|
||||
_4 = Len(_2); // scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
- _5 = Lt(_3, _4); // scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
+ _5 = Lt(const 2_usize, _4); // scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
+ assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, const 2_usize) -> bb1; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_1 = _2[_3]; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
StorageDead(_3); // scope 0 at $DIR/array_index.rs:+1:33: +1:34
|
||||
StorageDead(_2); // scope 0 at $DIR/array_index.rs:+1:33: +1:34
|
||||
_0 = const (); // scope 0 at $DIR/array_index.rs:+0:11: +2:2
|
||||
StorageDead(_1); // scope 0 at $DIR/array_index.rs:+2:1: +2:2
|
||||
return; // scope 0 at $DIR/array_index.rs:+2:2: +2:2
|
||||
}
|
||||
}
|
||||
|
@ -1,37 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/array_index.rs:+0:11: +0:11
|
||||
let _1: u32; // in scope 0 at $DIR/array_index.rs:+1:9: +1:10
|
||||
let mut _2: [u32; 4]; // in scope 0 at $DIR/array_index.rs:+1:18: +1:30
|
||||
let _3: usize; // in scope 0 at $DIR/array_index.rs:+1:31: +1:32
|
||||
let mut _4: usize; // in scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
let mut _5: bool; // in scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/array_index.rs:+1:9: +1:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/array_index.rs:+1:9: +1:10
|
||||
StorageLive(_2); // scope 0 at $DIR/array_index.rs:+1:18: +1:30
|
||||
_2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32]; // scope 0 at $DIR/array_index.rs:+1:18: +1:30
|
||||
StorageLive(_3); // scope 0 at $DIR/array_index.rs:+1:31: +1:32
|
||||
_3 = const 2_usize; // scope 0 at $DIR/array_index.rs:+1:31: +1:32
|
||||
_4 = Len(_2); // scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
- _5 = Lt(_3, _4); // scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
+ _5 = Lt(const 2_usize, _4); // scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
+ assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, const 2_usize) -> bb1; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_1 = _2[_3]; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
StorageDead(_3); // scope 0 at $DIR/array_index.rs:+1:33: +1:34
|
||||
StorageDead(_2); // scope 0 at $DIR/array_index.rs:+1:33: +1:34
|
||||
_0 = const (); // scope 0 at $DIR/array_index.rs:+0:11: +2:2
|
||||
StorageDead(_1); // scope 0 at $DIR/array_index.rs:+2:1: +2:2
|
||||
return; // scope 0 at $DIR/array_index.rs:+2:2: +2:2
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +0,0 @@
|
||||
// unit-test: DataflowConstProp
|
||||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||
|
||||
// EMIT_MIR array_index.main.DataflowConstProp.diff
|
||||
fn main() {
|
||||
let x: u32 = [0, 1, 2, 3][2];
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/bad_op_div_by_zero.rs:+0:11: +0:11
|
||||
let _1: i32; // in scope 0 at $DIR/bad_op_div_by_zero.rs:+1:9: +1:10
|
||||
let mut _3: i32; // in scope 0 at $DIR/bad_op_div_by_zero.rs:+2:18: +2:19
|
||||
let mut _4: bool; // in scope 0 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
let mut _5: bool; // in scope 0 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
let mut _6: bool; // in scope 0 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
let mut _7: bool; // in scope 0 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
scope 1 {
|
||||
debug y => _1; // in scope 1 at $DIR/bad_op_div_by_zero.rs:+1:9: +1:10
|
||||
let _2: i32; // in scope 1 at $DIR/bad_op_div_by_zero.rs:+2:9: +2:11
|
||||
scope 2 {
|
||||
debug _z => _2; // in scope 2 at $DIR/bad_op_div_by_zero.rs:+2:9: +2:11
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/bad_op_div_by_zero.rs:+1:9: +1:10
|
||||
_1 = const 0_i32; // scope 0 at $DIR/bad_op_div_by_zero.rs:+1:13: +1:14
|
||||
StorageLive(_2); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:9: +2:11
|
||||
StorageLive(_3); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:18: +2:19
|
||||
- _3 = _1; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:18: +2:19
|
||||
- _4 = Eq(_3, const 0_i32); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
- assert(!move _4, "attempt to divide `{}` by zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
+ _3 = const 0_i32; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:18: +2:19
|
||||
+ _4 = const true; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
+ assert(!const true, "attempt to divide `{}` by zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- _5 = Eq(_3, const -1_i32); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
- _6 = Eq(const 1_i32, const i32::MIN); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
- _7 = BitAnd(move _5, move _6); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
- assert(!move _7, "attempt to compute `{} / {}`, which would overflow", const 1_i32, _3) -> bb2; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
+ _5 = const false; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
+ _6 = const false; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
+ _7 = const false; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
+ assert(!const false, "attempt to compute `{} / {}`, which would overflow", const 1_i32, const 0_i32) -> bb2; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
}
|
||||
|
||||
bb2: {
|
||||
- _2 = Div(const 1_i32, move _3); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
+ _2 = Div(const 1_i32, const 0_i32); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
StorageDead(_3); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:18: +2:19
|
||||
_0 = const (); // scope 0 at $DIR/bad_op_div_by_zero.rs:+0:11: +3:2
|
||||
StorageDead(_2); // scope 1 at $DIR/bad_op_div_by_zero.rs:+3:1: +3:2
|
||||
StorageDead(_1); // scope 0 at $DIR/bad_op_div_by_zero.rs:+3:1: +3:2
|
||||
return; // scope 0 at $DIR/bad_op_div_by_zero.rs:+3:2: +3:2
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +0,0 @@
|
||||
// unit-test: DataflowConstProp
|
||||
// EMIT_MIR bad_op_div_by_zero.main.DataflowConstProp.diff
|
||||
#[allow(unconditional_panic)]
|
||||
fn main() {
|
||||
let y = 0;
|
||||
let _z = 1 / y;
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/bad_op_mod_by_zero.rs:+0:11: +0:11
|
||||
let _1: i32; // in scope 0 at $DIR/bad_op_mod_by_zero.rs:+1:9: +1:10
|
||||
let mut _3: i32; // in scope 0 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19
|
||||
let mut _4: bool; // in scope 0 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
let mut _5: bool; // in scope 0 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
let mut _6: bool; // in scope 0 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
let mut _7: bool; // in scope 0 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
scope 1 {
|
||||
debug y => _1; // in scope 1 at $DIR/bad_op_mod_by_zero.rs:+1:9: +1:10
|
||||
let _2: i32; // in scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:9: +2:11
|
||||
scope 2 {
|
||||
debug _z => _2; // in scope 2 at $DIR/bad_op_mod_by_zero.rs:+2:9: +2:11
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/bad_op_mod_by_zero.rs:+1:9: +1:10
|
||||
_1 = const 0_i32; // scope 0 at $DIR/bad_op_mod_by_zero.rs:+1:13: +1:14
|
||||
StorageLive(_2); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:9: +2:11
|
||||
StorageLive(_3); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19
|
||||
- _3 = _1; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19
|
||||
- _4 = Eq(_3, const 0_i32); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
- assert(!move _4, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
+ _3 = const 0_i32; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19
|
||||
+ _4 = const true; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
+ assert(!const true, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- _5 = Eq(_3, const -1_i32); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
- _6 = Eq(const 1_i32, const i32::MIN); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
- _7 = BitAnd(move _5, move _6); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
- assert(!move _7, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, _3) -> bb2; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
+ _5 = const false; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
+ _6 = const false; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
+ _7 = const false; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
+ assert(!const false, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, const 0_i32) -> bb2; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
}
|
||||
|
||||
bb2: {
|
||||
- _2 = Rem(const 1_i32, move _3); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
+ _2 = Rem(const 1_i32, const 0_i32); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
StorageDead(_3); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19
|
||||
_0 = const (); // scope 0 at $DIR/bad_op_mod_by_zero.rs:+0:11: +3:2
|
||||
StorageDead(_2); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+3:1: +3:2
|
||||
StorageDead(_1); // scope 0 at $DIR/bad_op_mod_by_zero.rs:+3:1: +3:2
|
||||
return; // scope 0 at $DIR/bad_op_mod_by_zero.rs:+3:2: +3:2
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +0,0 @@
|
||||
// unit-test: DataflowConstProp
|
||||
// EMIT_MIR bad_op_mod_by_zero.main.DataflowConstProp.diff
|
||||
#[allow(unconditional_panic)]
|
||||
fn main() {
|
||||
let y = 0;
|
||||
let _z = 1 % y;
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+0:11: +0:11
|
||||
let _1: *const [i32]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10
|
||||
let mut _2: *const [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
let _3: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
let _4: [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:26: +1:35
|
||||
let _6: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
|
||||
let mut _7: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
let mut _8: bool; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
let mut _9: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
scope 1 {
|
||||
debug a => _1; // in scope 1 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10
|
||||
scope 2 {
|
||||
let _5: i32; // in scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15
|
||||
scope 3 {
|
||||
debug _b => _5; // in scope 3 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10
|
||||
StorageLive(_2); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
StorageLive(_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
_9 = const _; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
// mir::Constant
|
||||
// + span: $DIR/bad_op_unsafe_oob_for_slices.rs:6:25: 6:35
|
||||
// + literal: Const { ty: &[i32; 3], val: Unevaluated(main, [], Some(promoted[0])) }
|
||||
_3 = &(*_9); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
_2 = &raw const (*_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
_1 = move _2 as *const [i32] (Pointer(Unsize)); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
StorageDead(_2); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:34: +1:35
|
||||
StorageDead(_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:35: +1:36
|
||||
StorageLive(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15
|
||||
StorageLive(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
|
||||
_6 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
|
||||
_7 = Len((*_1)); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
- _8 = Lt(_6, _7); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
+ _8 = Lt(const 3_usize, _7); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
+ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 3_usize) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_5 = (*_1)[_6]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
StorageDead(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:25: +3:26
|
||||
_0 = const (); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+2:5: +4:6
|
||||
StorageDead(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+4:5: +4:6
|
||||
StorageDead(_1); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+5:1: +5:2
|
||||
return; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+5:2: +5:2
|
||||
}
|
||||
}
|
||||
|
@ -1,56 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+0:11: +0:11
|
||||
let _1: *const [i32]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10
|
||||
let mut _2: *const [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
let _3: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
let _4: [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:26: +1:35
|
||||
let _6: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
|
||||
let mut _7: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
let mut _8: bool; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
let mut _9: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
scope 1 {
|
||||
debug a => _1; // in scope 1 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10
|
||||
scope 2 {
|
||||
let _5: i32; // in scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15
|
||||
scope 3 {
|
||||
debug _b => _5; // in scope 3 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10
|
||||
StorageLive(_2); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
StorageLive(_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
_9 = const _; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
// mir::Constant
|
||||
// + span: $DIR/bad_op_unsafe_oob_for_slices.rs:6:25: 6:35
|
||||
// + literal: Const { ty: &[i32; 3], val: Unevaluated(main, [], Some(promoted[0])) }
|
||||
_3 = &(*_9); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
_2 = &raw const (*_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
_1 = move _2 as *const [i32] (Pointer(Unsize)); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
StorageDead(_2); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:34: +1:35
|
||||
StorageDead(_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:35: +1:36
|
||||
StorageLive(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15
|
||||
StorageLive(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
|
||||
_6 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
|
||||
_7 = Len((*_1)); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
- _8 = Lt(_6, _7); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
+ _8 = Lt(const 3_usize, _7); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
+ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 3_usize) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_5 = (*_1)[_6]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
StorageDead(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:25: +3:26
|
||||
_0 = const (); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+2:5: +4:6
|
||||
StorageDead(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+4:5: +4:6
|
||||
StorageDead(_1); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+5:1: +5:2
|
||||
return; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+5:2: +5:2
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +0,0 @@
|
||||
// unit-test: DataflowConstProp
|
||||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||
// EMIT_MIR bad_op_unsafe_oob_for_slices.main.DataflowConstProp.diff
|
||||
#[allow(unconditional_panic)]
|
||||
fn main() {
|
||||
let a: *const [_] = &[1, 2, 3];
|
||||
unsafe {
|
||||
let _b = (*a)[3];
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
// unit-test: DataflowConstProp
|
||||
// compile-flags: -O -Zmir-opt-level=4
|
||||
|
||||
// EMIT_MIR boolean_identities.test.DataflowConstProp.diff
|
||||
pub fn test(x: bool, y: bool) -> bool {
|
||||
(y | true) & (x & false)
|
||||
}
|
||||
|
||||
fn main() {
|
||||
test(true, false);
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
- // MIR for `test` before DataflowConstProp
|
||||
+ // MIR for `test` after DataflowConstProp
|
||||
|
||||
fn test(_1: bool, _2: bool) -> bool {
|
||||
debug x => _1; // in scope 0 at $DIR/boolean_identities.rs:+0:13: +0:14
|
||||
debug y => _2; // in scope 0 at $DIR/boolean_identities.rs:+0:22: +0:23
|
||||
let mut _0: bool; // return place in scope 0 at $DIR/boolean_identities.rs:+0:34: +0:38
|
||||
let mut _3: bool; // in scope 0 at $DIR/boolean_identities.rs:+1:5: +1:15
|
||||
let mut _4: bool; // in scope 0 at $DIR/boolean_identities.rs:+1:6: +1:7
|
||||
let mut _5: bool; // in scope 0 at $DIR/boolean_identities.rs:+1:18: +1:29
|
||||
let mut _6: bool; // in scope 0 at $DIR/boolean_identities.rs:+1:19: +1:20
|
||||
|
||||
bb0: {
|
||||
StorageLive(_3); // scope 0 at $DIR/boolean_identities.rs:+1:5: +1:15
|
||||
StorageLive(_4); // scope 0 at $DIR/boolean_identities.rs:+1:6: +1:7
|
||||
_4 = _2; // scope 0 at $DIR/boolean_identities.rs:+1:6: +1:7
|
||||
_3 = const true; // scope 0 at $DIR/boolean_identities.rs:+1:5: +1:15
|
||||
StorageDead(_4); // scope 0 at $DIR/boolean_identities.rs:+1:14: +1:15
|
||||
StorageLive(_5); // scope 0 at $DIR/boolean_identities.rs:+1:18: +1:29
|
||||
StorageLive(_6); // scope 0 at $DIR/boolean_identities.rs:+1:19: +1:20
|
||||
_6 = _1; // scope 0 at $DIR/boolean_identities.rs:+1:19: +1:20
|
||||
_5 = const false; // scope 0 at $DIR/boolean_identities.rs:+1:18: +1:29
|
||||
StorageDead(_6); // scope 0 at $DIR/boolean_identities.rs:+1:28: +1:29
|
||||
_0 = const false; // scope 0 at $DIR/boolean_identities.rs:+1:5: +1:29
|
||||
StorageDead(_5); // scope 0 at $DIR/boolean_identities.rs:+1:28: +1:29
|
||||
StorageDead(_3); // scope 0 at $DIR/boolean_identities.rs:+1:28: +1:29
|
||||
return; // scope 0 at $DIR/boolean_identities.rs:+2:2: +2:2
|
||||
}
|
||||
}
|
||||
|
@ -1,58 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/boxes.rs:+0:11: +0:11
|
||||
let _1: i32; // in scope 0 at $DIR/boxes.rs:+1:9: +1:10
|
||||
let mut _2: i32; // in scope 0 at $DIR/boxes.rs:+1:13: +1:22
|
||||
let mut _3: std::boxed::Box<i32>; // in scope 0 at $DIR/boxes.rs:+1:14: +1:22
|
||||
let mut _4: usize; // in scope 0 at $DIR/boxes.rs:+1:14: +1:22
|
||||
let mut _5: usize; // in scope 0 at $DIR/boxes.rs:+1:14: +1:22
|
||||
let mut _6: *mut u8; // in scope 0 at $DIR/boxes.rs:+1:14: +1:22
|
||||
let mut _7: std::boxed::Box<i32>; // in scope 0 at $DIR/boxes.rs:+1:14: +1:22
|
||||
let mut _8: *const i32; // in scope 0 at $DIR/boxes.rs:+1:14: +1:22
|
||||
let mut _9: *const i32; // in scope 0 at $DIR/boxes.rs:+1:14: +1:22
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/boxes.rs:+1:9: +1:10
|
||||
}
|
||||
scope 2 {
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/boxes.rs:+1:9: +1:10
|
||||
StorageLive(_2); // scope 0 at $DIR/boxes.rs:+1:13: +1:22
|
||||
StorageLive(_3); // scope 0 at $DIR/boxes.rs:+1:14: +1:22
|
||||
_4 = SizeOf(i32); // scope 2 at $DIR/boxes.rs:+1:14: +1:22
|
||||
_5 = AlignOf(i32); // scope 2 at $DIR/boxes.rs:+1:14: +1:22
|
||||
_6 = alloc::alloc::exchange_malloc(move _4, move _5) -> bb1; // scope 2 at $DIR/boxes.rs:+1:14: +1:22
|
||||
// mir::Constant
|
||||
// + span: $DIR/boxes.rs:13:14: 13:22
|
||||
// + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value(<ZST>) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageLive(_7); // scope 0 at $DIR/boxes.rs:+1:14: +1:22
|
||||
_7 = ShallowInitBox(move _6, i32); // scope 0 at $DIR/boxes.rs:+1:14: +1:22
|
||||
_8 = (((_7.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32); // scope 0 at $DIR/boxes.rs:+1:19: +1:21
|
||||
(*_8) = const 42_i32; // scope 0 at $DIR/boxes.rs:+1:19: +1:21
|
||||
_3 = move _7; // scope 0 at $DIR/boxes.rs:+1:14: +1:22
|
||||
StorageDead(_7); // scope 0 at $DIR/boxes.rs:+1:21: +1:22
|
||||
_9 = (((_3.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32); // scope 0 at $DIR/boxes.rs:+1:13: +1:22
|
||||
_2 = (*_9); // scope 0 at $DIR/boxes.rs:+1:13: +1:22
|
||||
_1 = Add(move _2, const 0_i32); // scope 0 at $DIR/boxes.rs:+1:13: +1:26
|
||||
StorageDead(_2); // scope 0 at $DIR/boxes.rs:+1:25: +1:26
|
||||
drop(_3) -> [return: bb2, unwind: bb3]; // scope 0 at $DIR/boxes.rs:+1:26: +1:27
|
||||
}
|
||||
|
||||
bb2: {
|
||||
StorageDead(_3); // scope 0 at $DIR/boxes.rs:+1:26: +1:27
|
||||
_0 = const (); // scope 0 at $DIR/boxes.rs:+0:11: +2:2
|
||||
StorageDead(_1); // scope 0 at $DIR/boxes.rs:+2:1: +2:2
|
||||
return; // scope 0 at $DIR/boxes.rs:+2:2: +2:2
|
||||
}
|
||||
|
||||
bb3 (cleanup): {
|
||||
resume; // scope 0 at $DIR/boxes.rs:+0:1: +2:2
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +0,0 @@
|
||||
// unit-test: DataflowConstProp
|
||||
// compile-flags: -O
|
||||
// ignore-emscripten compiled with panic=abort by default
|
||||
// ignore-wasm32
|
||||
// ignore-wasm64
|
||||
|
||||
#![feature(box_syntax)]
|
||||
|
||||
// Note: this test verifies that we, in fact, do not const prop `box`
|
||||
|
||||
// EMIT_MIR boxes.main.DataflowConstProp.diff
|
||||
fn main() {
|
||||
let x = *(box 42) + 0;
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/cast.rs:+0:11: +0:11
|
||||
let _1: u32; // in scope 0 at $DIR/cast.rs:+1:9: +1:10
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/cast.rs:+1:9: +1:10
|
||||
let _2: u8; // in scope 1 at $DIR/cast.rs:+3:9: +3:10
|
||||
scope 2 {
|
||||
debug y => _2; // in scope 2 at $DIR/cast.rs:+3:9: +3:10
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/cast.rs:+1:9: +1:10
|
||||
- _1 = const 42_u8 as u32 (IntToInt); // scope 0 at $DIR/cast.rs:+1:13: +1:24
|
||||
+ _1 = const 42_u32; // scope 0 at $DIR/cast.rs:+1:13: +1:24
|
||||
StorageLive(_2); // scope 1 at $DIR/cast.rs:+3:9: +3:10
|
||||
- _2 = const 42_u32 as u8 (IntToInt); // scope 1 at $DIR/cast.rs:+3:13: +3:24
|
||||
+ _2 = const 42_u8; // scope 1 at $DIR/cast.rs:+3:13: +3:24
|
||||
_0 = const (); // scope 0 at $DIR/cast.rs:+0:11: +4:2
|
||||
StorageDead(_2); // scope 1 at $DIR/cast.rs:+4:1: +4:2
|
||||
StorageDead(_1); // scope 0 at $DIR/cast.rs:+4:1: +4:2
|
||||
return; // scope 0 at $DIR/cast.rs:+4:2: +4:2
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +0,0 @@
|
||||
// unit-test: DataflowConstProp
|
||||
// EMIT_MIR cast.main.DataflowConstProp.diff
|
||||
|
||||
fn main() {
|
||||
let x = 42u8 as u32;
|
||||
|
||||
let y = 42u32 as u8;
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/checked_add.rs:+0:11: +0:11
|
||||
let _1: u32; // in scope 0 at $DIR/checked_add.rs:+1:9: +1:10
|
||||
let mut _2: (u32, bool); // in scope 0 at $DIR/checked_add.rs:+1:18: +1:23
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/checked_add.rs:+1:9: +1:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/checked_add.rs:+1:9: +1:10
|
||||
_2 = CheckedAdd(const 1_u32, const 1_u32); // scope 0 at $DIR/checked_add.rs:+1:18: +1:23
|
||||
- assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 1_u32, const 1_u32) -> bb1; // scope 0 at $DIR/checked_add.rs:+1:18: +1:23
|
||||
+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 1_u32, const 1_u32) -> bb1; // scope 0 at $DIR/checked_add.rs:+1:18: +1:23
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- _1 = move (_2.0: u32); // scope 0 at $DIR/checked_add.rs:+1:18: +1:23
|
||||
+ _1 = const 2_u32; // scope 0 at $DIR/checked_add.rs:+1:18: +1:23
|
||||
_0 = const (); // scope 0 at $DIR/checked_add.rs:+0:11: +2:2
|
||||
StorageDead(_1); // scope 0 at $DIR/checked_add.rs:+2:1: +2:2
|
||||
return; // scope 0 at $DIR/checked_add.rs:+2:2: +2:2
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +0,0 @@
|
||||
// unit-test: DataflowConstProp
|
||||
// compile-flags: -C overflow-checks=on
|
||||
|
||||
// EMIT_MIR checked_add.main.DataflowConstProp.diff
|
||||
fn main() {
|
||||
let x: u32 = 1 + 1;
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/const_prop_fails_gracefully.rs:+0:11: +0:11
|
||||
let _1: usize; // in scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:9: +2:10
|
||||
let mut _2: *const i32; // in scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:30
|
||||
let _3: &i32; // in scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:16
|
||||
let _4: (); // in scope 0 at $DIR/const_prop_fails_gracefully.rs:+3:5: +3:12
|
||||
let mut _5: usize; // in scope 0 at $DIR/const_prop_fails_gracefully.rs:+3:10: +3:11
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/const_prop_fails_gracefully.rs:+2:9: +2:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:9: +2:10
|
||||
StorageLive(_2); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:30
|
||||
StorageLive(_3); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:16
|
||||
_3 = const _; // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:16
|
||||
// mir::Constant
|
||||
// + span: $DIR/const_prop_fails_gracefully.rs:8:13: 8:16
|
||||
// + literal: Const { ty: &i32, val: Unevaluated(FOO, [], None) }
|
||||
_2 = &raw const (*_3); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:16
|
||||
_1 = move _2 as usize (PointerExposeAddress); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:39
|
||||
StorageDead(_2); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:38: +2:39
|
||||
StorageDead(_3); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:39: +2:40
|
||||
StorageLive(_4); // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:5: +3:12
|
||||
StorageLive(_5); // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:10: +3:11
|
||||
_5 = _1; // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:10: +3:11
|
||||
_4 = read(move _5) -> bb1; // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:5: +3:12
|
||||
// mir::Constant
|
||||
// + span: $DIR/const_prop_fails_gracefully.rs:9:5: 9:9
|
||||
// + literal: Const { ty: fn(usize) {read}, val: Value(<ZST>) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageDead(_5); // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:11: +3:12
|
||||
StorageDead(_4); // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:12: +3:13
|
||||
_0 = const (); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+0:11: +4:2
|
||||
StorageDead(_1); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+4:1: +4:2
|
||||
return; // scope 0 at $DIR/const_prop_fails_gracefully.rs:+4:2: +4:2
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +0,0 @@
|
||||
// unit-test: DataflowConstProp
|
||||
#[inline(never)]
|
||||
fn read(_: usize) {}
|
||||
|
||||
// EMIT_MIR const_prop_fails_gracefully.main.DataflowConstProp.diff
|
||||
fn main() {
|
||||
const FOO: &i32 = &1;
|
||||
let x = FOO as *const i32 as usize;
|
||||
read(x);
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
// unit-test: DataflowConstProp
|
||||
// compile-flags: -Zmir-opt-level=1
|
||||
|
||||
trait NeedsDrop: Sized {
|
||||
const NEEDS: bool = std::mem::needs_drop::<Self>();
|
||||
}
|
||||
|
||||
impl<This> NeedsDrop for This {}
|
||||
|
||||
// EMIT_MIR control_flow_simplification.hello.DataflowConstProp.diff
|
||||
// EMIT_MIR control_flow_simplification.hello.PreCodegen.before.mir
|
||||
fn hello<T>() {
|
||||
if <bool>::NEEDS {
|
||||
panic!()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
hello::<()>();
|
||||
hello::<Vec<()>>();
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
- // MIR for `hello` before DataflowConstProp
|
||||
+ // MIR for `hello` after DataflowConstProp
|
||||
|
||||
fn hello() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/control-flow-simplification.rs:+0:15: +0:15
|
||||
let mut _1: bool; // in scope 0 at $DIR/control-flow-simplification.rs:+1:8: +1:21
|
||||
let mut _2: !; // in scope 0 at $SRC_DIR/std/src/panic.rs:LL:COL
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/control-flow-simplification.rs:+1:8: +1:21
|
||||
_1 = const _; // scope 0 at $DIR/control-flow-simplification.rs:+1:8: +1:21
|
||||
switchInt(const false) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/control-flow-simplification.rs:+1:8: +1:21
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageLive(_2); // scope 0 at $SRC_DIR/std/src/panic.rs:LL:COL
|
||||
_2 = begin_panic::<&str>(const "explicit panic"); // scope 0 at $SRC_DIR/std/src/panic.rs:LL:COL
|
||||
// mir::Constant
|
||||
// + span: $SRC_DIR/std/src/panic.rs:LL:COL
|
||||
// + literal: Const { ty: fn(&str) -> ! {begin_panic::<&str>}, val: Value(<ZST>) }
|
||||
// mir::Constant
|
||||
// + span: $SRC_DIR/std/src/panic.rs:LL:COL
|
||||
// + literal: Const { ty: &str, val: Value(Slice(..)) }
|
||||
}
|
||||
|
||||
bb2: {
|
||||
nop; // scope 0 at $DIR/control-flow-simplification.rs:+3:6: +3:6
|
||||
StorageDead(_1); // scope 0 at $DIR/control-flow-simplification.rs:+3:5: +3:6
|
||||
return; // scope 0 at $DIR/control-flow-simplification.rs:+4:2: +4:2
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +0,0 @@
|
||||
// MIR for `hello` before PreCodegen
|
||||
|
||||
fn hello() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/control-flow-simplification.rs:+0:15: +0:15
|
||||
|
||||
bb0: {
|
||||
return; // scope 0 at $DIR/control-flow-simplification.rs:+4:2: +4:2
|
||||
}
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/discriminant.rs:+0:11: +0:11
|
||||
let _1: i32; // in scope 0 at $DIR/discriminant.rs:+1:9: +1:10
|
||||
let mut _2: i32; // in scope 0 at $DIR/discriminant.rs:+1:13: +1:64
|
||||
let mut _3: std::option::Option<bool>; // in scope 0 at $DIR/discriminant.rs:+1:34: +1:44
|
||||
let mut _4: isize; // in scope 0 at $DIR/discriminant.rs:+1:21: +1:31
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/discriminant.rs:+1:9: +1:10
|
||||
}
|
||||
scope 2 {
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/discriminant.rs:+1:9: +1:10
|
||||
StorageLive(_2); // scope 0 at $DIR/discriminant.rs:+1:13: +1:64
|
||||
StorageLive(_3); // scope 2 at $DIR/discriminant.rs:+1:34: +1:44
|
||||
Deinit(_3); // scope 2 at $DIR/discriminant.rs:+1:34: +1:44
|
||||
((_3 as Some).0: bool) = const true; // scope 2 at $DIR/discriminant.rs:+1:34: +1:44
|
||||
discriminant(_3) = 1; // scope 2 at $DIR/discriminant.rs:+1:34: +1:44
|
||||
_4 = discriminant(_3); // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
|
||||
switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
|
||||
}
|
||||
|
||||
bb1: {
|
||||
switchInt(((_3 as Some).0: bool)) -> [false: bb3, otherwise: bb2]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
|
||||
}
|
||||
|
||||
bb2: {
|
||||
_2 = const 42_i32; // scope 2 at $DIR/discriminant.rs:+1:47: +1:49
|
||||
goto -> bb4; // scope 0 at $DIR/discriminant.rs:+1:13: +1:64
|
||||
}
|
||||
|
||||
bb3: {
|
||||
_2 = const 10_i32; // scope 0 at $DIR/discriminant.rs:+1:59: +1:61
|
||||
goto -> bb4; // scope 0 at $DIR/discriminant.rs:+1:13: +1:64
|
||||
}
|
||||
|
||||
bb4: {
|
||||
_1 = Add(move _2, const 0_i32); // scope 0 at $DIR/discriminant.rs:+1:13: +1:68
|
||||
StorageDead(_2); // scope 0 at $DIR/discriminant.rs:+1:67: +1:68
|
||||
StorageDead(_3); // scope 0 at $DIR/discriminant.rs:+1:68: +1:69
|
||||
_0 = const (); // scope 0 at $DIR/discriminant.rs:+0:11: +2:2
|
||||
StorageDead(_1); // scope 0 at $DIR/discriminant.rs:+2:1: +2:2
|
||||
return; // scope 0 at $DIR/discriminant.rs:+2:2: +2:2
|
||||
}
|
||||
}
|
||||
|
@ -1,50 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/discriminant.rs:+0:11: +0:11
|
||||
let _1: i32; // in scope 0 at $DIR/discriminant.rs:+1:9: +1:10
|
||||
let mut _2: i32; // in scope 0 at $DIR/discriminant.rs:+1:13: +1:64
|
||||
let mut _3: std::option::Option<bool>; // in scope 0 at $DIR/discriminant.rs:+1:34: +1:44
|
||||
let mut _4: isize; // in scope 0 at $DIR/discriminant.rs:+1:21: +1:31
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/discriminant.rs:+1:9: +1:10
|
||||
}
|
||||
scope 2 {
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/discriminant.rs:+1:9: +1:10
|
||||
StorageLive(_2); // scope 0 at $DIR/discriminant.rs:+1:13: +1:64
|
||||
StorageLive(_3); // scope 2 at $DIR/discriminant.rs:+1:34: +1:44
|
||||
Deinit(_3); // scope 2 at $DIR/discriminant.rs:+1:34: +1:44
|
||||
((_3 as Some).0: bool) = const true; // scope 2 at $DIR/discriminant.rs:+1:34: +1:44
|
||||
discriminant(_3) = 1; // scope 2 at $DIR/discriminant.rs:+1:34: +1:44
|
||||
_4 = discriminant(_3); // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
|
||||
switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
|
||||
}
|
||||
|
||||
bb1: {
|
||||
switchInt(((_3 as Some).0: bool)) -> [false: bb3, otherwise: bb2]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
|
||||
}
|
||||
|
||||
bb2: {
|
||||
_2 = const 42_i32; // scope 2 at $DIR/discriminant.rs:+1:47: +1:49
|
||||
goto -> bb4; // scope 0 at $DIR/discriminant.rs:+1:13: +1:64
|
||||
}
|
||||
|
||||
bb3: {
|
||||
_2 = const 10_i32; // scope 0 at $DIR/discriminant.rs:+1:59: +1:61
|
||||
goto -> bb4; // scope 0 at $DIR/discriminant.rs:+1:13: +1:64
|
||||
}
|
||||
|
||||
bb4: {
|
||||
_1 = Add(move _2, const 0_i32); // scope 0 at $DIR/discriminant.rs:+1:13: +1:68
|
||||
StorageDead(_2); // scope 0 at $DIR/discriminant.rs:+1:67: +1:68
|
||||
StorageDead(_3); // scope 0 at $DIR/discriminant.rs:+1:68: +1:69
|
||||
_0 = const (); // scope 0 at $DIR/discriminant.rs:+0:11: +2:2
|
||||
StorageDead(_1); // scope 0 at $DIR/discriminant.rs:+2:1: +2:2
|
||||
return; // scope 0 at $DIR/discriminant.rs:+2:2: +2:2
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +0,0 @@
|
||||
// unit-test: DataflowConstProp
|
||||
// compile-flags: -O
|
||||
|
||||
// FIXME(wesleywiser): Ideally, we could const-prop away all of this and just be left with
|
||||
// `let x = 42` but that doesn't work because const-prop doesn't support `Operand::Indirect`
|
||||
// and `InterpCx::eval_place()` always forces an allocation which creates the `Indirect`.
|
||||
// Fixing either of those will allow us to const-prop this away.
|
||||
|
||||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||
// EMIT_MIR discriminant.main.DataflowConstProp.diff
|
||||
fn main() {
|
||||
let x = (if let Some(true) = Some(true) { 42 } else { 10 }) + 0;
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/indirect.rs:+0:11: +0:11
|
||||
let _1: u8; // in scope 0 at $DIR/indirect.rs:+1:9: +1:10
|
||||
let mut _2: u8; // in scope 0 at $DIR/indirect.rs:+1:13: +1:25
|
||||
let mut _3: (u8, bool); // in scope 0 at $DIR/indirect.rs:+1:13: +1:29
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/indirect.rs:+1:9: +1:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/indirect.rs:+1:9: +1:10
|
||||
StorageLive(_2); // scope 0 at $DIR/indirect.rs:+1:13: +1:25
|
||||
- _2 = const 2_u32 as u8 (IntToInt); // scope 0 at $DIR/indirect.rs:+1:13: +1:25
|
||||
- _3 = CheckedAdd(_2, const 1_u8); // scope 0 at $DIR/indirect.rs:+1:13: +1:29
|
||||
- assert(!move (_3.1: bool), "attempt to compute `{} + {}`, which would overflow", move _2, const 1_u8) -> bb1; // scope 0 at $DIR/indirect.rs:+1:13: +1:29
|
||||
+ _2 = const 2_u8; // scope 0 at $DIR/indirect.rs:+1:13: +1:25
|
||||
+ _3 = CheckedAdd(const 2_u8, const 1_u8); // scope 0 at $DIR/indirect.rs:+1:13: +1:29
|
||||
+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_u8, const 1_u8) -> bb1; // scope 0 at $DIR/indirect.rs:+1:13: +1:29
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- _1 = move (_3.0: u8); // scope 0 at $DIR/indirect.rs:+1:13: +1:29
|
||||
+ _1 = const 3_u8; // scope 0 at $DIR/indirect.rs:+1:13: +1:29
|
||||
StorageDead(_2); // scope 0 at $DIR/indirect.rs:+1:28: +1:29
|
||||
_0 = const (); // scope 0 at $DIR/indirect.rs:+0:11: +2:2
|
||||
StorageDead(_1); // scope 0 at $DIR/indirect.rs:+2:1: +2:2
|
||||
return; // scope 0 at $DIR/indirect.rs:+2:2: +2:2
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +0,0 @@
|
||||
// unit-test: DataflowConstProp
|
||||
// compile-flags: -C overflow-checks=on
|
||||
|
||||
// EMIT_MIR indirect.main.DataflowConstProp.diff
|
||||
fn main() {
|
||||
let x = (2u32 as u8) + 1;
|
||||
}
|
@ -1,74 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/invalid_constant.rs:+0:11: +0:11
|
||||
let _1: char; // in scope 0 at $DIR/invalid_constant.rs:+6:9: +6:22
|
||||
let mut _2: main::InvalidChar; // in scope 0 at $DIR/invalid_constant.rs:+6:34: +6:63
|
||||
let mut _4: E; // in scope 0 at $DIR/invalid_constant.rs:+13:25: +13:59
|
||||
let mut _5: main::InvalidTag; // in scope 0 at $DIR/invalid_constant.rs:+13:34: +13:55
|
||||
let mut _7: Empty; // in scope 0 at $DIR/invalid_constant.rs:+20:35: +20:73
|
||||
let mut _8: main::NoVariants; // in scope 0 at $DIR/invalid_constant.rs:+20:44: +20:65
|
||||
scope 1 {
|
||||
debug _invalid_char => _1; // in scope 1 at $DIR/invalid_constant.rs:+6:9: +6:22
|
||||
let _3: [E; 1]; // in scope 1 at $DIR/invalid_constant.rs:+13:9: +13:21
|
||||
scope 3 {
|
||||
debug _invalid_tag => _3; // in scope 3 at $DIR/invalid_constant.rs:+13:9: +13:21
|
||||
let _6: [Empty; 1]; // in scope 3 at $DIR/invalid_constant.rs:+20:9: +20:31
|
||||
scope 5 {
|
||||
debug _enum_without_variants => _6; // in scope 5 at $DIR/invalid_constant.rs:+20:9: +20:31
|
||||
let _9: main::Str<"<22><><EFBFBD>">; // in scope 5 at $DIR/invalid_constant.rs:+24:9: +24:22
|
||||
scope 7 {
|
||||
debug _non_utf8_str => _9; // in scope 7 at $DIR/invalid_constant.rs:+24:9: +24:22
|
||||
}
|
||||
}
|
||||
scope 6 {
|
||||
}
|
||||
}
|
||||
scope 4 {
|
||||
}
|
||||
}
|
||||
scope 2 {
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/invalid_constant.rs:+6:9: +6:22
|
||||
StorageLive(_2); // scope 2 at $DIR/invalid_constant.rs:+6:34: +6:63
|
||||
Deinit(_2); // scope 2 at $DIR/invalid_constant.rs:+6:34: +6:63
|
||||
(_2.0: u32) = const 1114113_u32; // scope 2 at $DIR/invalid_constant.rs:+6:34: +6:63
|
||||
_1 = const {transmute(0x00110001): char}; // scope 2 at $DIR/invalid_constant.rs:+6:34: +6:67
|
||||
StorageDead(_2); // scope 0 at $DIR/invalid_constant.rs:+6:69: +6:70
|
||||
StorageLive(_3); // scope 1 at $DIR/invalid_constant.rs:+13:9: +13:21
|
||||
StorageLive(_4); // scope 1 at $DIR/invalid_constant.rs:+13:25: +13:59
|
||||
StorageLive(_5); // scope 4 at $DIR/invalid_constant.rs:+13:34: +13:55
|
||||
Deinit(_5); // scope 4 at $DIR/invalid_constant.rs:+13:34: +13:55
|
||||
(_5.0: u32) = const 4_u32; // scope 4 at $DIR/invalid_constant.rs:+13:34: +13:55
|
||||
_4 = const Scalar(0x00000004): E; // scope 4 at $DIR/invalid_constant.rs:+13:34: +13:57
|
||||
// mir::Constant
|
||||
// + span: $DIR/invalid_constant.rs:32:34: 32:57
|
||||
// + literal: Const { ty: E, val: Value(Scalar(0x00000004)) }
|
||||
_3 = [const Scalar(0x00000004): E]; // scope 1 at $DIR/invalid_constant.rs:+13:24: +13:60
|
||||
// mir::Constant
|
||||
// + span: $DIR/invalid_constant.rs:32:24: 32:60
|
||||
// + literal: Const { ty: E, val: Value(Scalar(0x00000004)) }
|
||||
StorageDead(_4); // scope 1 at $DIR/invalid_constant.rs:+13:59: +13:60
|
||||
StorageDead(_5); // scope 1 at $DIR/invalid_constant.rs:+13:60: +13:61
|
||||
StorageLive(_6); // scope 3 at $DIR/invalid_constant.rs:+20:9: +20:31
|
||||
StorageLive(_7); // scope 3 at $DIR/invalid_constant.rs:+20:35: +20:73
|
||||
StorageLive(_8); // scope 6 at $DIR/invalid_constant.rs:+20:44: +20:65
|
||||
Deinit(_8); // scope 6 at $DIR/invalid_constant.rs:+20:44: +20:65
|
||||
(_8.0: u32) = const 0_u32; // scope 6 at $DIR/invalid_constant.rs:+20:44: +20:65
|
||||
nop; // scope 6 at $DIR/invalid_constant.rs:+20:44: +20:71
|
||||
nop; // scope 3 at $DIR/invalid_constant.rs:+20:34: +20:74
|
||||
StorageDead(_7); // scope 3 at $DIR/invalid_constant.rs:+20:73: +20:74
|
||||
StorageDead(_8); // scope 3 at $DIR/invalid_constant.rs:+20:74: +20:75
|
||||
StorageLive(_9); // scope 5 at $DIR/invalid_constant.rs:+24:9: +24:22
|
||||
nop; // scope 0 at $DIR/invalid_constant.rs:+0:11: +25:2
|
||||
StorageDead(_9); // scope 5 at $DIR/invalid_constant.rs:+25:1: +25:2
|
||||
StorageDead(_6); // scope 3 at $DIR/invalid_constant.rs:+25:1: +25:2
|
||||
StorageDead(_3); // scope 1 at $DIR/invalid_constant.rs:+25:1: +25:2
|
||||
StorageDead(_1); // scope 0 at $DIR/invalid_constant.rs:+25:1: +25:2
|
||||
return; // scope 0 at $DIR/invalid_constant.rs:+25:2: +25:2
|
||||
}
|
||||
}
|
||||
|
@ -1,44 +0,0 @@
|
||||
// Verify that we can pretty print invalid constants.
|
||||
|
||||
#![feature(adt_const_params)]
|
||||
#![feature(inline_const)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(u32)]
|
||||
enum E {
|
||||
A,
|
||||
B,
|
||||
C,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
enum Empty {}
|
||||
|
||||
// EMIT_MIR invalid_constant.main.DataflowConstProp.diff
|
||||
fn main() {
|
||||
// An invalid char.
|
||||
union InvalidChar {
|
||||
int: u32,
|
||||
chr: char,
|
||||
}
|
||||
let _invalid_char = unsafe { InvalidChar { int: 0x110001 }.chr };
|
||||
|
||||
// An enum with an invalid tag. Regression test for #93688.
|
||||
union InvalidTag {
|
||||
int: u32,
|
||||
e: E,
|
||||
}
|
||||
let _invalid_tag = [unsafe { InvalidTag { int: 4 }.e }];
|
||||
|
||||
// An enum without variants. Regression test for #94073.
|
||||
union NoVariants {
|
||||
int: u32,
|
||||
empty: Empty,
|
||||
}
|
||||
let _enum_without_variants = [unsafe { NoVariants { int: 0 }.empty }];
|
||||
|
||||
// A non-UTF-8 string slice. Regression test for #75763 and #78520.
|
||||
struct Str<const S: &'static str>;
|
||||
let _non_utf8_str: Str<{ unsafe { std::mem::transmute::<&[u8], &str>(&[0xC0, 0xC1, 0xF5]) } }>;
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
// unit-test: DataflowConstProp
|
||||
// compile-flags: -Z mir-opt-level=3
|
||||
|
||||
// Due to a bug in propagating scalar pairs the assertion below used to fail. In the expected
|
||||
// outputs below, after DataflowConstProp this is how _2 would look like with the bug:
|
||||
//
|
||||
// _2 = (const Scalar(0x00) : (), const 0u8);
|
||||
//
|
||||
// Which has the wrong type.
|
||||
|
||||
fn encode(this: ((), u8, u8)) {
|
||||
assert!(this.2 == 0);
|
||||
}
|
||||
|
||||
// EMIT_MIR issue_66971.main.DataflowConstProp.diff
|
||||
fn main() {
|
||||
encode(((), 0, 0));
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
// unit-test: DataflowConstProp
|
||||
// compile-flags: -Z mir-opt-level=3
|
||||
|
||||
// This used to ICE in const-prop
|
||||
|
||||
fn test(this: ((u8, u8),)) {
|
||||
assert!((this.0).0 == 1);
|
||||
}
|
||||
|
||||
// EMIT_MIR issue_67019.main.DataflowConstProp.diff
|
||||
fn main() {
|
||||
test(((1, 2),));
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/issue-66971.rs:+0:11: +0:11
|
||||
let _1: (); // in scope 0 at $DIR/issue-66971.rs:+1:5: +1:23
|
||||
let mut _2: ((), u8, u8); // in scope 0 at $DIR/issue-66971.rs:+1:12: +1:22
|
||||
let mut _3: (); // in scope 0 at $DIR/issue-66971.rs:+1:13: +1:15
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/issue-66971.rs:+1:5: +1:23
|
||||
StorageLive(_2); // scope 0 at $DIR/issue-66971.rs:+1:12: +1:22
|
||||
StorageLive(_3); // scope 0 at $DIR/issue-66971.rs:+1:13: +1:15
|
||||
nop; // scope 0 at $DIR/issue-66971.rs:+1:13: +1:15
|
||||
Deinit(_2); // scope 0 at $DIR/issue-66971.rs:+1:12: +1:22
|
||||
nop; // scope 0 at $DIR/issue-66971.rs:+1:12: +1:22
|
||||
(_2.1: u8) = const 0_u8; // scope 0 at $DIR/issue-66971.rs:+1:12: +1:22
|
||||
(_2.2: u8) = const 0_u8; // scope 0 at $DIR/issue-66971.rs:+1:12: +1:22
|
||||
StorageDead(_3); // scope 0 at $DIR/issue-66971.rs:+1:21: +1:22
|
||||
_1 = encode(move _2) -> bb1; // scope 0 at $DIR/issue-66971.rs:+1:5: +1:23
|
||||
// mir::Constant
|
||||
// + span: $DIR/issue-66971.rs:17:5: 17:11
|
||||
// + literal: Const { ty: fn(((), u8, u8)) {encode}, val: Value(<ZST>) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageDead(_2); // scope 0 at $DIR/issue-66971.rs:+1:22: +1:23
|
||||
StorageDead(_1); // scope 0 at $DIR/issue-66971.rs:+1:23: +1:24
|
||||
nop; // scope 0 at $DIR/issue-66971.rs:+0:11: +2:2
|
||||
return; // scope 0 at $DIR/issue-66971.rs:+2:2: +2:2
|
||||
}
|
||||
}
|
||||
|
@ -1,33 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/issue-67019.rs:+0:11: +0:11
|
||||
let _1: (); // in scope 0 at $DIR/issue-67019.rs:+1:5: +1:20
|
||||
let mut _2: ((u8, u8),); // in scope 0 at $DIR/issue-67019.rs:+1:10: +1:19
|
||||
let mut _3: (u8, u8); // in scope 0 at $DIR/issue-67019.rs:+1:11: +1:17
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/issue-67019.rs:+1:5: +1:20
|
||||
StorageLive(_2); // scope 0 at $DIR/issue-67019.rs:+1:10: +1:19
|
||||
StorageLive(_3); // scope 0 at $DIR/issue-67019.rs:+1:11: +1:17
|
||||
Deinit(_3); // scope 0 at $DIR/issue-67019.rs:+1:11: +1:17
|
||||
(_3.0: u8) = const 1_u8; // scope 0 at $DIR/issue-67019.rs:+1:11: +1:17
|
||||
(_3.1: u8) = const 2_u8; // scope 0 at $DIR/issue-67019.rs:+1:11: +1:17
|
||||
Deinit(_2); // scope 0 at $DIR/issue-67019.rs:+1:10: +1:19
|
||||
(_2.0: (u8, u8)) = const (1_u8, 2_u8); // scope 0 at $DIR/issue-67019.rs:+1:10: +1:19
|
||||
StorageDead(_3); // scope 0 at $DIR/issue-67019.rs:+1:18: +1:19
|
||||
_1 = test(move _2) -> bb1; // scope 0 at $DIR/issue-67019.rs:+1:5: +1:20
|
||||
// mir::Constant
|
||||
// + span: $DIR/issue-67019.rs:12:5: 12:9
|
||||
// + literal: Const { ty: fn(((u8, u8),)) {test}, val: Value(<ZST>) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageDead(_2); // scope 0 at $DIR/issue-67019.rs:+1:19: +1:20
|
||||
StorageDead(_1); // scope 0 at $DIR/issue-67019.rs:+1:20: +1:21
|
||||
nop; // scope 0 at $DIR/issue-67019.rs:+0:11: +2:2
|
||||
return; // scope 0 at $DIR/issue-67019.rs:+2:2: +2:2
|
||||
}
|
||||
}
|
||||
|
@ -1,35 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/large_array_index.rs:+0:11: +0:11
|
||||
let _1: u8; // in scope 0 at $DIR/large_array_index.rs:+2:9: +2:10
|
||||
let mut _2: [u8; 5000]; // in scope 0 at $DIR/large_array_index.rs:+2:17: +2:29
|
||||
let _3: usize; // in scope 0 at $DIR/large_array_index.rs:+2:30: +2:31
|
||||
let mut _4: usize; // in scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
|
||||
let mut _5: bool; // in scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/large_array_index.rs:+2:9: +2:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/large_array_index.rs:+2:9: +2:10
|
||||
StorageLive(_2); // scope 0 at $DIR/large_array_index.rs:+2:17: +2:29
|
||||
_2 = [const 0_u8; 5000]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:29
|
||||
StorageLive(_3); // scope 0 at $DIR/large_array_index.rs:+2:30: +2:31
|
||||
_3 = const 2_usize; // scope 0 at $DIR/large_array_index.rs:+2:30: +2:31
|
||||
_4 = const 5000_usize; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
|
||||
_5 = const true; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
|
||||
assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> bb1; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_1 = _2[_3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
|
||||
StorageDead(_3); // scope 0 at $DIR/large_array_index.rs:+2:32: +2:33
|
||||
StorageDead(_2); // scope 0 at $DIR/large_array_index.rs:+2:32: +2:33
|
||||
nop; // scope 0 at $DIR/large_array_index.rs:+0:11: +3:2
|
||||
StorageDead(_1); // scope 0 at $DIR/large_array_index.rs:+3:1: +3:2
|
||||
return; // scope 0 at $DIR/large_array_index.rs:+3:2: +3:2
|
||||
}
|
||||
}
|
||||
|
@ -1,35 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/large_array_index.rs:+0:11: +0:11
|
||||
let _1: u8; // in scope 0 at $DIR/large_array_index.rs:+2:9: +2:10
|
||||
let mut _2: [u8; 5000]; // in scope 0 at $DIR/large_array_index.rs:+2:17: +2:29
|
||||
let _3: usize; // in scope 0 at $DIR/large_array_index.rs:+2:30: +2:31
|
||||
let mut _4: usize; // in scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
|
||||
let mut _5: bool; // in scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/large_array_index.rs:+2:9: +2:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/large_array_index.rs:+2:9: +2:10
|
||||
StorageLive(_2); // scope 0 at $DIR/large_array_index.rs:+2:17: +2:29
|
||||
_2 = [const 0_u8; 5000]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:29
|
||||
StorageLive(_3); // scope 0 at $DIR/large_array_index.rs:+2:30: +2:31
|
||||
_3 = const 2_usize; // scope 0 at $DIR/large_array_index.rs:+2:30: +2:31
|
||||
_4 = const 5000_usize; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
|
||||
_5 = const true; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
|
||||
assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> bb1; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_1 = _2[_3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
|
||||
StorageDead(_3); // scope 0 at $DIR/large_array_index.rs:+2:32: +2:33
|
||||
StorageDead(_2); // scope 0 at $DIR/large_array_index.rs:+2:32: +2:33
|
||||
nop; // scope 0 at $DIR/large_array_index.rs:+0:11: +3:2
|
||||
StorageDead(_1); // scope 0 at $DIR/large_array_index.rs:+3:1: +3:2
|
||||
return; // scope 0 at $DIR/large_array_index.rs:+3:2: +3:2
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +0,0 @@
|
||||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||
|
||||
// EMIT_MIR large_array_index.main.DataflowConstProp.diff
|
||||
fn main() {
|
||||
// check that we don't propagate this, because it's too large
|
||||
let x: u8 = [0_u8; 5000][2];
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
// unit-test: DataflowConstProp
|
||||
|
||||
// EMIT_MIR mult_by_zero.test.DataflowConstProp.diff
|
||||
fn test(x: i32) -> i32 {
|
||||
x * 0
|
||||
}
|
||||
|
||||
fn main() {
|
||||
test(10);
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
- // MIR for `test` before DataflowConstProp
|
||||
+ // MIR for `test` after DataflowConstProp
|
||||
|
||||
fn test(_1: i32) -> i32 {
|
||||
debug x => _1; // in scope 0 at $DIR/mult_by_zero.rs:+0:9: +0:10
|
||||
let mut _0: i32; // return place in scope 0 at $DIR/mult_by_zero.rs:+0:20: +0:23
|
||||
let mut _2: i32; // in scope 0 at $DIR/mult_by_zero.rs:+1:5: +1:6
|
||||
|
||||
bb0: {
|
||||
StorageLive(_2); // scope 0 at $DIR/mult_by_zero.rs:+1:5: +1:6
|
||||
_2 = _1; // scope 0 at $DIR/mult_by_zero.rs:+1:5: +1:6
|
||||
_0 = Mul(move _2, const 0_i32); // scope 0 at $DIR/mult_by_zero.rs:+1:5: +1:10
|
||||
StorageDead(_2); // scope 0 at $DIR/mult_by_zero.rs:+1:9: +1:10
|
||||
return; // scope 0 at $DIR/mult_by_zero.rs:+2:2: +2:2
|
||||
}
|
||||
}
|
||||
|
@ -1,28 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/mutable_variable.rs:+0:11: +0:11
|
||||
let mut _1: i32; // in scope 0 at $DIR/mutable_variable.rs:+1:9: +1:14
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/mutable_variable.rs:+1:9: +1:14
|
||||
let _2: i32; // in scope 1 at $DIR/mutable_variable.rs:+3:9: +3:10
|
||||
scope 2 {
|
||||
debug y => _2; // in scope 2 at $DIR/mutable_variable.rs:+3:9: +3:10
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/mutable_variable.rs:+1:9: +1:14
|
||||
_1 = const 42_i32; // scope 0 at $DIR/mutable_variable.rs:+1:17: +1:19
|
||||
_1 = const 99_i32; // scope 1 at $DIR/mutable_variable.rs:+2:5: +2:11
|
||||
StorageLive(_2); // scope 1 at $DIR/mutable_variable.rs:+3:9: +3:10
|
||||
- _2 = _1; // scope 1 at $DIR/mutable_variable.rs:+3:13: +3:14
|
||||
+ _2 = const 99_i32; // scope 1 at $DIR/mutable_variable.rs:+3:13: +3:14
|
||||
_0 = const (); // scope 0 at $DIR/mutable_variable.rs:+0:11: +4:2
|
||||
StorageDead(_2); // scope 1 at $DIR/mutable_variable.rs:+4:1: +4:2
|
||||
StorageDead(_1); // scope 0 at $DIR/mutable_variable.rs:+4:1: +4:2
|
||||
return; // scope 0 at $DIR/mutable_variable.rs:+4:2: +4:2
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +0,0 @@
|
||||
// unit-test: DataflowConstProp
|
||||
|
||||
// EMIT_MIR mutable_variable.main.DataflowConstProp.diff
|
||||
fn main() {
|
||||
let mut x = 42;
|
||||
x = 99;
|
||||
let y = x;
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/mutable_variable_aggregate.rs:+0:11: +0:11
|
||||
let mut _1: (i32, i32); // in scope 0 at $DIR/mutable_variable_aggregate.rs:+1:9: +1:14
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/mutable_variable_aggregate.rs:+1:9: +1:14
|
||||
let _2: (i32, i32); // in scope 1 at $DIR/mutable_variable_aggregate.rs:+3:9: +3:10
|
||||
scope 2 {
|
||||
debug y => _2; // in scope 2 at $DIR/mutable_variable_aggregate.rs:+3:9: +3:10
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/mutable_variable_aggregate.rs:+1:9: +1:14
|
||||
Deinit(_1); // scope 0 at $DIR/mutable_variable_aggregate.rs:+1:17: +1:25
|
||||
(_1.0: i32) = const 42_i32; // scope 0 at $DIR/mutable_variable_aggregate.rs:+1:17: +1:25
|
||||
(_1.1: i32) = const 43_i32; // scope 0 at $DIR/mutable_variable_aggregate.rs:+1:17: +1:25
|
||||
(_1.1: i32) = const 99_i32; // scope 1 at $DIR/mutable_variable_aggregate.rs:+2:5: +2:13
|
||||
StorageLive(_2); // scope 1 at $DIR/mutable_variable_aggregate.rs:+3:9: +3:10
|
||||
_2 = _1; // scope 1 at $DIR/mutable_variable_aggregate.rs:+3:13: +3:14
|
||||
_0 = const (); // scope 0 at $DIR/mutable_variable_aggregate.rs:+0:11: +4:2
|
||||
StorageDead(_2); // scope 1 at $DIR/mutable_variable_aggregate.rs:+4:1: +4:2
|
||||
StorageDead(_1); // scope 0 at $DIR/mutable_variable_aggregate.rs:+4:1: +4:2
|
||||
return; // scope 0 at $DIR/mutable_variable_aggregate.rs:+4:2: +4:2
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +0,0 @@
|
||||
// unit-test: DataflowConstProp
|
||||
|
||||
// EMIT_MIR mutable_variable_aggregate.main.DataflowConstProp.diff
|
||||
fn main() {
|
||||
let mut x = (42, 43);
|
||||
x.1 = 99;
|
||||
let y = x;
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+0:11: +0:11
|
||||
let mut _1: (i32, i32); // in scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+1:9: +1:14
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/mutable_variable_aggregate_mut_ref.rs:+1:9: +1:14
|
||||
let _2: &mut (i32, i32); // in scope 1 at $DIR/mutable_variable_aggregate_mut_ref.rs:+2:9: +2:10
|
||||
scope 2 {
|
||||
debug z => _2; // in scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+2:9: +2:10
|
||||
let _3: (i32, i32); // in scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:9: +4:10
|
||||
scope 3 {
|
||||
debug y => _3; // in scope 3 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:9: +4:10
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+1:9: +1:14
|
||||
Deinit(_1); // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+1:17: +1:25
|
||||
(_1.0: i32) = const 42_i32; // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+1:17: +1:25
|
||||
(_1.1: i32) = const 43_i32; // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+1:17: +1:25
|
||||
StorageLive(_2); // scope 1 at $DIR/mutable_variable_aggregate_mut_ref.rs:+2:9: +2:10
|
||||
_2 = &mut _1; // scope 1 at $DIR/mutable_variable_aggregate_mut_ref.rs:+2:13: +2:19
|
||||
((*_2).1: i32) = const 99_i32; // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+3:5: +3:13
|
||||
StorageLive(_3); // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:9: +4:10
|
||||
_3 = _1; // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:13: +4:14
|
||||
_0 = const (); // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+0:11: +5:2
|
||||
StorageDead(_3); // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+5:1: +5:2
|
||||
StorageDead(_2); // scope 1 at $DIR/mutable_variable_aggregate_mut_ref.rs:+5:1: +5:2
|
||||
StorageDead(_1); // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+5:1: +5:2
|
||||
return; // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+5:2: +5:2
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +0,0 @@
|
||||
// unit-test: DataflowConstProp
|
||||
|
||||
// EMIT_MIR mutable_variable_aggregate_mut_ref.main.DataflowConstProp.diff
|
||||
fn main() {
|
||||
let mut x = (42, 43);
|
||||
let z = &mut x;
|
||||
z.1 = 99;
|
||||
let y = x;
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+0:11: +0:11
|
||||
let mut _1: (i32, i32); // in scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+1:9: +1:14
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+1:9: +1:14
|
||||
let _2: i32; // in scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:9: +4:10
|
||||
scope 2 {
|
||||
debug y => _2; // in scope 2 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:9: +4:10
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+1:9: +1:14
|
||||
_1 = foo() -> bb1; // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+1:29: +1:34
|
||||
// mir::Constant
|
||||
// + span: $DIR/mutable_variable_aggregate_partial_read.rs:5:29: 5:32
|
||||
// + literal: Const { ty: fn() -> (i32, i32) {foo}, val: Value(<ZST>) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
(_1.1: i32) = const 99_i32; // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+2:5: +2:13
|
||||
(_1.0: i32) = const 42_i32; // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+3:5: +3:13
|
||||
StorageLive(_2); // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:9: +4:10
|
||||
- _2 = (_1.1: i32); // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:13: +4:16
|
||||
+ _2 = const 99_i32; // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:13: +4:16
|
||||
_0 = const (); // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+0:11: +5:2
|
||||
StorageDead(_2); // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+5:1: +5:2
|
||||
StorageDead(_1); // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+5:1: +5:2
|
||||
return; // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+5:2: +5:2
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +0,0 @@
|
||||
// unit-test: DataflowConstProp
|
||||
|
||||
// EMIT_MIR mutable_variable_aggregate_partial_read.main.DataflowConstProp.diff
|
||||
fn main() {
|
||||
let mut x: (i32, i32) = foo();
|
||||
x.1 = 99;
|
||||
x.0 = 42;
|
||||
let y = x.1;
|
||||
}
|
||||
|
||||
#[inline(never)]
|
||||
fn foo() -> (i32, i32) {
|
||||
unimplemented!()
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/mutable_variable_no_prop.rs:+0:11: +0:11
|
||||
let mut _1: u32; // in scope 0 at $DIR/mutable_variable_no_prop.rs:+1:9: +1:14
|
||||
let _2: (); // in scope 0 at $DIR/mutable_variable_no_prop.rs:+2:5: +4:6
|
||||
let mut _3: u32; // in scope 0 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19
|
||||
let mut _4: *mut u32; // in scope 0 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/mutable_variable_no_prop.rs:+1:9: +1:14
|
||||
let _5: u32; // in scope 1 at $DIR/mutable_variable_no_prop.rs:+5:9: +5:10
|
||||
scope 2 {
|
||||
}
|
||||
scope 3 {
|
||||
debug y => _5; // in scope 3 at $DIR/mutable_variable_no_prop.rs:+5:9: +5:10
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/mutable_variable_no_prop.rs:+1:9: +1:14
|
||||
_1 = const 42_u32; // scope 0 at $DIR/mutable_variable_no_prop.rs:+1:17: +1:19
|
||||
StorageLive(_2); // scope 1 at $DIR/mutable_variable_no_prop.rs:+2:5: +4:6
|
||||
StorageLive(_3); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19
|
||||
StorageLive(_4); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19
|
||||
_4 = const {alloc1: *mut u32}; // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19
|
||||
// mir::Constant
|
||||
// + span: $DIR/mutable_variable_no_prop.rs:9:13: 9:19
|
||||
// + literal: Const { ty: *mut u32, val: Value(Scalar(alloc1)) }
|
||||
_3 = (*_4); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19
|
||||
_1 = move _3; // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:9: +3:19
|
||||
StorageDead(_3); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:18: +3:19
|
||||
StorageDead(_4); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:19: +3:20
|
||||
_2 = const (); // scope 2 at $DIR/mutable_variable_no_prop.rs:+2:5: +4:6
|
||||
StorageDead(_2); // scope 1 at $DIR/mutable_variable_no_prop.rs:+4:5: +4:6
|
||||
StorageLive(_5); // scope 1 at $DIR/mutable_variable_no_prop.rs:+5:9: +5:10
|
||||
_5 = _1; // scope 1 at $DIR/mutable_variable_no_prop.rs:+5:13: +5:14
|
||||
_0 = const (); // scope 0 at $DIR/mutable_variable_no_prop.rs:+0:11: +6:2
|
||||
StorageDead(_5); // scope 1 at $DIR/mutable_variable_no_prop.rs:+6:1: +6:2
|
||||
StorageDead(_1); // scope 0 at $DIR/mutable_variable_no_prop.rs:+6:1: +6:2
|
||||
return; // scope 0 at $DIR/mutable_variable_no_prop.rs:+6:2: +6:2
|
||||
}
|
||||
}
|
||||
|
||||
alloc1 (static: STATIC, size: 4, align: 4) {
|
||||
2a 00 00 00 │ *...
|
||||
}
|
||||
|
@ -1,12 +0,0 @@
|
||||
// unit-test: DataflowConstProp
|
||||
|
||||
static mut STATIC: u32 = 42;
|
||||
|
||||
// EMIT_MIR mutable_variable_no_prop.main.DataflowConstProp.diff
|
||||
fn main() {
|
||||
let mut x = 42;
|
||||
unsafe {
|
||||
x = STATIC;
|
||||
}
|
||||
let y = x;
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/mutable_variable_unprop_assign.rs:+0:11: +0:11
|
||||
let _1: i32; // in scope 0 at $DIR/mutable_variable_unprop_assign.rs:+1:9: +1:10
|
||||
let mut _3: i32; // in scope 0 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12
|
||||
scope 1 {
|
||||
debug a => _1; // in scope 1 at $DIR/mutable_variable_unprop_assign.rs:+1:9: +1:10
|
||||
let mut _2: (i32, i32); // in scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14
|
||||
scope 2 {
|
||||
debug x => _2; // in scope 2 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14
|
||||
let _4: i32; // in scope 2 at $DIR/mutable_variable_unprop_assign.rs:+4:9: +4:10
|
||||
scope 3 {
|
||||
debug y => _4; // in scope 3 at $DIR/mutable_variable_unprop_assign.rs:+4:9: +4:10
|
||||
let _5: i32; // in scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:9: +5:10
|
||||
scope 4 {
|
||||
debug z => _5; // in scope 4 at $DIR/mutable_variable_unprop_assign.rs:+5:9: +5:10
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+1:9: +1:10
|
||||
_1 = foo() -> bb1; // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+1:13: +1:18
|
||||
// mir::Constant
|
||||
// + span: $DIR/mutable_variable_unprop_assign.rs:5:13: 5:16
|
||||
// + literal: Const { ty: fn() -> i32 {foo}, val: Value(<ZST>) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageLive(_2); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14
|
||||
Deinit(_2); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:29: +2:35
|
||||
(_2.0: i32) = const 1_i32; // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:29: +2:35
|
||||
(_2.1: i32) = const 2_i32; // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:29: +2:35
|
||||
StorageLive(_3); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12
|
||||
_3 = _1; // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12
|
||||
(_2.1: i32) = move _3; // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:5: +3:12
|
||||
StorageDead(_3); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12
|
||||
StorageLive(_4); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+4:9: +4:10
|
||||
_4 = (_2.1: i32); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+4:13: +4:16
|
||||
StorageLive(_5); // scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:9: +5:10
|
||||
- _5 = (_2.0: i32); // scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:13: +5:16
|
||||
+ _5 = const 1_i32; // scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:13: +5:16
|
||||
_0 = const (); // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+0:11: +6:2
|
||||
StorageDead(_5); // scope 3 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2
|
||||
StorageDead(_4); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2
|
||||
StorageDead(_2); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2
|
||||
StorageDead(_1); // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2
|
||||
return; // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+6:2: +6:2
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +0,0 @@
|
||||
// unit-test: DataflowConstProp
|
||||
|
||||
// EMIT_MIR mutable_variable_unprop_assign.main.DataflowConstProp.diff
|
||||
fn main() {
|
||||
let a = foo();
|
||||
let mut x: (i32, i32) = (1, 2);
|
||||
x.1 = a;
|
||||
let y = x.1;
|
||||
let z = x.0; // this could theoretically be allowed, but we can't handle it right now
|
||||
}
|
||||
|
||||
#[inline(never)]
|
||||
fn foo() -> i32 {
|
||||
unimplemented!()
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11
|
||||
let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
|
||||
let mut _2: (i32, bool); // in scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18
|
||||
let mut _4: [i32; 6]; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:31
|
||||
let _5: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:32: +2:33
|
||||
let mut _6: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
|
||||
let mut _7: bool; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
|
||||
let mut _9: Point; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:37
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
|
||||
let _3: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
|
||||
scope 2 {
|
||||
debug y => _3; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
|
||||
let _8: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
|
||||
scope 3 {
|
||||
debug z => _8; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
|
||||
_2 = const (4_i32, false); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18
|
||||
assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> bb1; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_1 = const 4_i32; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18
|
||||
StorageLive(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
|
||||
StorageLive(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31
|
||||
_4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31
|
||||
StorageLive(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33
|
||||
_5 = const 3_usize; // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33
|
||||
_6 = const 6_usize; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
|
||||
_7 = const true; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
|
||||
assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> bb2; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
|
||||
}
|
||||
|
||||
bb2: {
|
||||
_3 = const 3_i32; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
|
||||
StorageDead(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35
|
||||
StorageDead(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35
|
||||
StorageLive(_8); // scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
|
||||
StorageLive(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:37
|
||||
Deinit(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:37
|
||||
(_9.0: u32) = const 12_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:37
|
||||
(_9.1: u32) = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:37
|
||||
_8 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:39
|
||||
StorageDead(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:39: +3:40
|
||||
nop; // scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +4:2
|
||||
StorageDead(_8); // scope 2 at $DIR/optimizes_into_variable.rs:+4:1: +4:2
|
||||
StorageDead(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+4:1: +4:2
|
||||
StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+4:1: +4:2
|
||||
return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2
|
||||
}
|
||||
}
|
||||
|
@ -1,61 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11
|
||||
let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
|
||||
let mut _2: (i32, bool); // in scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18
|
||||
let mut _4: [i32; 6]; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:31
|
||||
let _5: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:32: +2:33
|
||||
let mut _6: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
|
||||
let mut _7: bool; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
|
||||
let mut _9: Point; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:37
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
|
||||
let _3: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
|
||||
scope 2 {
|
||||
debug y => _3; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
|
||||
let _8: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
|
||||
scope 3 {
|
||||
debug z => _8; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
|
||||
_2 = const (4_i32, false); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18
|
||||
assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> bb1; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_1 = const 4_i32; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18
|
||||
StorageLive(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
|
||||
StorageLive(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31
|
||||
_4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31
|
||||
StorageLive(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33
|
||||
_5 = const 3_usize; // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33
|
||||
_6 = const 6_usize; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
|
||||
_7 = const true; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
|
||||
assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> bb2; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
|
||||
}
|
||||
|
||||
bb2: {
|
||||
_3 = const 3_i32; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
|
||||
StorageDead(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35
|
||||
StorageDead(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35
|
||||
StorageLive(_8); // scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
|
||||
StorageLive(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:37
|
||||
Deinit(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:37
|
||||
(_9.0: u32) = const 12_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:37
|
||||
(_9.1: u32) = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:37
|
||||
_8 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:39
|
||||
StorageDead(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:39: +3:40
|
||||
nop; // scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +4:2
|
||||
StorageDead(_8); // scope 2 at $DIR/optimizes_into_variable.rs:+4:1: +4:2
|
||||
StorageDead(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+4:1: +4:2
|
||||
StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+4:1: +4:2
|
||||
return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2
|
||||
}
|
||||
}
|
||||
|
@ -1,27 +0,0 @@
|
||||
// MIR for `main` after SimplifyLocals
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11
|
||||
let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
|
||||
let _2: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
|
||||
scope 2 {
|
||||
debug y => _2; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
|
||||
let _3: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
|
||||
scope 3 {
|
||||
debug z => _3; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
|
||||
StorageLive(_2); // scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
|
||||
StorageLive(_3); // scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
|
||||
StorageDead(_3); // scope 2 at $DIR/optimizes_into_variable.rs:+4:1: +4:2
|
||||
StorageDead(_2); // scope 1 at $DIR/optimizes_into_variable.rs:+4:1: +4:2
|
||||
StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+4:1: +4:2
|
||||
return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2
|
||||
}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
// MIR for `main` after SimplifyLocals
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11
|
||||
let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
|
||||
let _2: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
|
||||
scope 2 {
|
||||
debug y => _2; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
|
||||
let _3: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
|
||||
scope 3 {
|
||||
debug z => _3; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
|
||||
StorageLive(_2); // scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
|
||||
StorageLive(_3); // scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
|
||||
StorageDead(_3); // scope 2 at $DIR/optimizes_into_variable.rs:+4:1: +4:2
|
||||
StorageDead(_2); // scope 1 at $DIR/optimizes_into_variable.rs:+4:1: +4:2
|
||||
StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+4:1: +4:2
|
||||
return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
// unit-test
|
||||
// compile-flags: -C overflow-checks=on
|
||||
|
||||
struct Point {
|
||||
x: u32,
|
||||
y: u32,
|
||||
}
|
||||
|
||||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||
// EMIT_MIR optimizes_into_variable.main.DataflowConstProp.diff
|
||||
// EMIT_MIR optimizes_into_variable.main.SimplifyLocals.after.mir
|
||||
fn main() {
|
||||
let x = 2 + 2;
|
||||
let y = [0, 1, 2, 3, 4, 5][3];
|
||||
let z = (Point { x: 12, y: 42 }).y;
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/read_immutable_static.rs:+0:11: +0:11
|
||||
let _1: u8; // in scope 0 at $DIR/read_immutable_static.rs:+1:9: +1:10
|
||||
let mut _2: u8; // in scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:16
|
||||
let mut _3: &u8; // in scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:16
|
||||
let mut _4: u8; // in scope 0 at $DIR/read_immutable_static.rs:+1:19: +1:22
|
||||
let mut _5: &u8; // in scope 0 at $DIR/read_immutable_static.rs:+1:19: +1:22
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/read_immutable_static.rs:+1:9: +1:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/read_immutable_static.rs:+1:9: +1:10
|
||||
StorageLive(_2); // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:16
|
||||
StorageLive(_3); // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:16
|
||||
_3 = const {alloc1: &u8}; // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:16
|
||||
// mir::Constant
|
||||
// + span: $DIR/read_immutable_static.rs:7:13: 7:16
|
||||
// + literal: Const { ty: &u8, val: Value(Scalar(alloc1)) }
|
||||
_2 = (*_3); // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:16
|
||||
StorageLive(_4); // scope 0 at $DIR/read_immutable_static.rs:+1:19: +1:22
|
||||
StorageLive(_5); // scope 0 at $DIR/read_immutable_static.rs:+1:19: +1:22
|
||||
_5 = const {alloc1: &u8}; // scope 0 at $DIR/read_immutable_static.rs:+1:19: +1:22
|
||||
// mir::Constant
|
||||
// + span: $DIR/read_immutable_static.rs:7:19: 7:22
|
||||
// + literal: Const { ty: &u8, val: Value(Scalar(alloc1)) }
|
||||
_4 = (*_5); // scope 0 at $DIR/read_immutable_static.rs:+1:19: +1:22
|
||||
_1 = Add(move _2, move _4); // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:22
|
||||
StorageDead(_4); // scope 0 at $DIR/read_immutable_static.rs:+1:21: +1:22
|
||||
StorageDead(_2); // scope 0 at $DIR/read_immutable_static.rs:+1:21: +1:22
|
||||
StorageDead(_5); // scope 0 at $DIR/read_immutable_static.rs:+1:22: +1:23
|
||||
StorageDead(_3); // scope 0 at $DIR/read_immutable_static.rs:+1:22: +1:23
|
||||
_0 = const (); // scope 0 at $DIR/read_immutable_static.rs:+0:11: +2:2
|
||||
StorageDead(_1); // scope 0 at $DIR/read_immutable_static.rs:+2:1: +2:2
|
||||
return; // scope 0 at $DIR/read_immutable_static.rs:+2:2: +2:2
|
||||
}
|
||||
}
|
||||
|
||||
alloc1 (static: FOO, size: 1, align: 1) {
|
||||
02 │ .
|
||||
}
|
||||
|
@ -1,8 +0,0 @@
|
||||
// unit-test: DataflowConstProp
|
||||
|
||||
static FOO: u8 = 2;
|
||||
|
||||
// EMIT_MIR read_immutable_static.main.DataflowConstProp.diff
|
||||
fn main() {
|
||||
let x = FOO + FOO;
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/ref_deref.rs:+0:11: +0:11
|
||||
let _1: i32; // in scope 0 at $DIR/ref_deref.rs:+1:5: +1:10
|
||||
let mut _2: &i32; // in scope 0 at $DIR/ref_deref.rs:+1:6: +1:10
|
||||
let _3: i32; // in scope 0 at $DIR/ref_deref.rs:+1:8: +1:9
|
||||
let mut _4: &i32; // in scope 0 at $DIR/ref_deref.rs:+1:6: +1:10
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/ref_deref.rs:+1:5: +1:10
|
||||
StorageLive(_2); // scope 0 at $DIR/ref_deref.rs:+1:6: +1:10
|
||||
_4 = const _; // scope 0 at $DIR/ref_deref.rs:+1:6: +1:10
|
||||
// mir::Constant
|
||||
// + span: $DIR/ref_deref.rs:6:6: 6:10
|
||||
// + literal: Const { ty: &i32, val: Unevaluated(main, [], Some(promoted[0])) }
|
||||
_2 = &(*_4); // scope 0 at $DIR/ref_deref.rs:+1:6: +1:10
|
||||
_1 = (*_2); // scope 0 at $DIR/ref_deref.rs:+1:5: +1:10
|
||||
StorageDead(_2); // scope 0 at $DIR/ref_deref.rs:+1:10: +1:11
|
||||
StorageDead(_1); // scope 0 at $DIR/ref_deref.rs:+1:10: +1:11
|
||||
_0 = const (); // scope 0 at $DIR/ref_deref.rs:+0:11: +2:2
|
||||
return; // scope 0 at $DIR/ref_deref.rs:+2:2: +2:2
|
||||
}
|
||||
}
|
||||
|
@ -1,30 +0,0 @@
|
||||
- // MIR for `main` before PromoteTemps
|
||||
+ // MIR for `main` after PromoteTemps
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/ref_deref.rs:+0:11: +0:11
|
||||
let _1: i32; // in scope 0 at $DIR/ref_deref.rs:+1:5: +1:10
|
||||
let mut _2: &i32; // in scope 0 at $DIR/ref_deref.rs:+1:6: +1:10
|
||||
let _3: i32; // in scope 0 at $DIR/ref_deref.rs:+1:8: +1:9
|
||||
+ let mut _4: &i32; // in scope 0 at $DIR/ref_deref.rs:+1:6: +1:10
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/ref_deref.rs:+1:5: +1:10
|
||||
StorageLive(_2); // scope 0 at $DIR/ref_deref.rs:+1:6: +1:10
|
||||
- StorageLive(_3); // scope 0 at $DIR/ref_deref.rs:+1:8: +1:9
|
||||
- _3 = const 4_i32; // scope 0 at $DIR/ref_deref.rs:+1:8: +1:9
|
||||
- _2 = &_3; // scope 0 at $DIR/ref_deref.rs:+1:6: +1:10
|
||||
+ _4 = const _; // scope 0 at $DIR/ref_deref.rs:+1:6: +1:10
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/ref_deref.rs:6:6: 6:10
|
||||
+ // + literal: Const { ty: &i32, val: Unevaluated(main, [], Some(promoted[0])) }
|
||||
+ _2 = &(*_4); // scope 0 at $DIR/ref_deref.rs:+1:6: +1:10
|
||||
_1 = (*_2); // scope 0 at $DIR/ref_deref.rs:+1:5: +1:10
|
||||
- StorageDead(_3); // scope 0 at $DIR/ref_deref.rs:+1:10: +1:11
|
||||
StorageDead(_2); // scope 0 at $DIR/ref_deref.rs:+1:10: +1:11
|
||||
StorageDead(_1); // scope 0 at $DIR/ref_deref.rs:+1:10: +1:11
|
||||
_0 = const (); // scope 0 at $DIR/ref_deref.rs:+0:11: +2:2
|
||||
return; // scope 0 at $DIR/ref_deref.rs:+2:2: +2:2
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +0,0 @@
|
||||
// unit-test: DataflowConstProp
|
||||
// EMIT_MIR ref_deref.main.PromoteTemps.diff
|
||||
// EMIT_MIR ref_deref.main.DataflowConstProp.diff
|
||||
|
||||
fn main() {
|
||||
*(&4);
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/ref_deref_project.rs:+0:11: +0:11
|
||||
let _1: i32; // in scope 0 at $DIR/ref_deref_project.rs:+1:5: +1:17
|
||||
let mut _2: &i32; // in scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17
|
||||
let _3: (i32, i32); // in scope 0 at $DIR/ref_deref_project.rs:+1:8: +1:14
|
||||
let mut _4: &(i32, i32); // in scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/ref_deref_project.rs:+1:5: +1:17
|
||||
StorageLive(_2); // scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17
|
||||
_4 = const _; // scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17
|
||||
// mir::Constant
|
||||
// + span: $DIR/ref_deref_project.rs:6:6: 6:17
|
||||
// + literal: Const { ty: &(i32, i32), val: Unevaluated(main, [], Some(promoted[0])) }
|
||||
_2 = &((*_4).1: i32); // scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17
|
||||
_1 = (*_2); // scope 0 at $DIR/ref_deref_project.rs:+1:5: +1:17
|
||||
StorageDead(_2); // scope 0 at $DIR/ref_deref_project.rs:+1:17: +1:18
|
||||
StorageDead(_1); // scope 0 at $DIR/ref_deref_project.rs:+1:17: +1:18
|
||||
_0 = const (); // scope 0 at $DIR/ref_deref_project.rs:+0:11: +2:2
|
||||
return; // scope 0 at $DIR/ref_deref_project.rs:+2:2: +2:2
|
||||
}
|
||||
}
|
||||
|
@ -1,30 +0,0 @@
|
||||
- // MIR for `main` before PromoteTemps
|
||||
+ // MIR for `main` after PromoteTemps
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/ref_deref_project.rs:+0:11: +0:11
|
||||
let _1: i32; // in scope 0 at $DIR/ref_deref_project.rs:+1:5: +1:17
|
||||
let mut _2: &i32; // in scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17
|
||||
let _3: (i32, i32); // in scope 0 at $DIR/ref_deref_project.rs:+1:8: +1:14
|
||||
+ let mut _4: &(i32, i32); // in scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/ref_deref_project.rs:+1:5: +1:17
|
||||
StorageLive(_2); // scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17
|
||||
- StorageLive(_3); // scope 0 at $DIR/ref_deref_project.rs:+1:8: +1:14
|
||||
- _3 = (const 4_i32, const 5_i32); // scope 0 at $DIR/ref_deref_project.rs:+1:8: +1:14
|
||||
- _2 = &(_3.1: i32); // scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17
|
||||
+ _4 = const _; // scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/ref_deref_project.rs:6:6: 6:17
|
||||
+ // + literal: Const { ty: &(i32, i32), val: Unevaluated(main, [], Some(promoted[0])) }
|
||||
+ _2 = &((*_4).1: i32); // scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17
|
||||
_1 = (*_2); // scope 0 at $DIR/ref_deref_project.rs:+1:5: +1:17
|
||||
- StorageDead(_3); // scope 0 at $DIR/ref_deref_project.rs:+1:17: +1:18
|
||||
StorageDead(_2); // scope 0 at $DIR/ref_deref_project.rs:+1:17: +1:18
|
||||
StorageDead(_1); // scope 0 at $DIR/ref_deref_project.rs:+1:17: +1:18
|
||||
_0 = const (); // scope 0 at $DIR/ref_deref_project.rs:+0:11: +2:2
|
||||
return; // scope 0 at $DIR/ref_deref_project.rs:+2:2: +2:2
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +0,0 @@
|
||||
// unit-test: DataflowConstProp
|
||||
// EMIT_MIR ref_deref_project.main.PromoteTemps.diff
|
||||
// EMIT_MIR ref_deref_project.main.DataflowConstProp.diff
|
||||
|
||||
fn main() {
|
||||
*(&(4, 5).1); // This does not currently propagate (#67862)
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/reify_fn_ptr.rs:+0:11: +0:11
|
||||
let mut _1: *const fn(); // in scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:41
|
||||
let mut _2: usize; // in scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:26
|
||||
let mut _3: fn(); // in scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:17
|
||||
scope 1 {
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:41
|
||||
StorageLive(_2); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:26
|
||||
StorageLive(_3); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:17
|
||||
_3 = main as fn() (Pointer(ReifyFnPointer)); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:17
|
||||
// mir::Constant
|
||||
// + span: $DIR/reify_fn_ptr.rs:5:13: 5:17
|
||||
// + literal: Const { ty: fn() {main}, val: Value(<ZST>) }
|
||||
_2 = move _3 as usize (PointerExposeAddress); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:26
|
||||
StorageDead(_3); // scope 0 at $DIR/reify_fn_ptr.rs:+1:25: +1:26
|
||||
_1 = move _2 as *const fn() (PointerFromExposedAddress); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:41
|
||||
StorageDead(_2); // scope 0 at $DIR/reify_fn_ptr.rs:+1:40: +1:41
|
||||
StorageDead(_1); // scope 0 at $DIR/reify_fn_ptr.rs:+1:41: +1:42
|
||||
_0 = const (); // scope 0 at $DIR/reify_fn_ptr.rs:+0:11: +2:2
|
||||
return; // scope 0 at $DIR/reify_fn_ptr.rs:+2:2: +2:2
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +0,0 @@
|
||||
// unit-test: DataflowConstProp
|
||||
// EMIT_MIR reify_fn_ptr.main.DataflowConstProp.diff
|
||||
|
||||
fn main() {
|
||||
let _ = main as usize as *const fn();
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/repeat.rs:+0:11: +0:11
|
||||
let _1: u32; // in scope 0 at $DIR/repeat.rs:+1:9: +1:10
|
||||
let mut _2: u32; // in scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
let mut _3: [u32; 8]; // in scope 0 at $DIR/repeat.rs:+1:18: +1:25
|
||||
let _4: usize; // in scope 0 at $DIR/repeat.rs:+1:26: +1:27
|
||||
let mut _5: usize; // in scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
let mut _6: bool; // in scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/repeat.rs:+1:9: +1:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/repeat.rs:+1:9: +1:10
|
||||
StorageLive(_2); // scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
StorageLive(_3); // scope 0 at $DIR/repeat.rs:+1:18: +1:25
|
||||
_3 = [const 42_u32; 8]; // scope 0 at $DIR/repeat.rs:+1:18: +1:25
|
||||
StorageLive(_4); // scope 0 at $DIR/repeat.rs:+1:26: +1:27
|
||||
_4 = const 2_usize; // scope 0 at $DIR/repeat.rs:+1:26: +1:27
|
||||
_5 = Len(_3); // scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
- _6 = Lt(_4, _5); // scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> bb1; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
+ _6 = Lt(const 2_usize, _5); // scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
+ assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, const 2_usize) -> bb1; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_2 = _3[_4]; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
_1 = Add(move _2, const 0_u32); // scope 0 at $DIR/repeat.rs:+1:18: +1:32
|
||||
StorageDead(_2); // scope 0 at $DIR/repeat.rs:+1:31: +1:32
|
||||
StorageDead(_4); // scope 0 at $DIR/repeat.rs:+1:32: +1:33
|
||||
StorageDead(_3); // scope 0 at $DIR/repeat.rs:+1:32: +1:33
|
||||
_0 = const (); // scope 0 at $DIR/repeat.rs:+0:11: +2:2
|
||||
StorageDead(_1); // scope 0 at $DIR/repeat.rs:+2:1: +2:2
|
||||
return; // scope 0 at $DIR/repeat.rs:+2:2: +2:2
|
||||
}
|
||||
}
|
||||
|
@ -1,41 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/repeat.rs:+0:11: +0:11
|
||||
let _1: u32; // in scope 0 at $DIR/repeat.rs:+1:9: +1:10
|
||||
let mut _2: u32; // in scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
let mut _3: [u32; 8]; // in scope 0 at $DIR/repeat.rs:+1:18: +1:25
|
||||
let _4: usize; // in scope 0 at $DIR/repeat.rs:+1:26: +1:27
|
||||
let mut _5: usize; // in scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
let mut _6: bool; // in scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/repeat.rs:+1:9: +1:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/repeat.rs:+1:9: +1:10
|
||||
StorageLive(_2); // scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
StorageLive(_3); // scope 0 at $DIR/repeat.rs:+1:18: +1:25
|
||||
_3 = [const 42_u32; 8]; // scope 0 at $DIR/repeat.rs:+1:18: +1:25
|
||||
StorageLive(_4); // scope 0 at $DIR/repeat.rs:+1:26: +1:27
|
||||
_4 = const 2_usize; // scope 0 at $DIR/repeat.rs:+1:26: +1:27
|
||||
_5 = Len(_3); // scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
- _6 = Lt(_4, _5); // scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> bb1; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
+ _6 = Lt(const 2_usize, _5); // scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
+ assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, const 2_usize) -> bb1; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_2 = _3[_4]; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
_1 = Add(move _2, const 0_u32); // scope 0 at $DIR/repeat.rs:+1:18: +1:32
|
||||
StorageDead(_2); // scope 0 at $DIR/repeat.rs:+1:31: +1:32
|
||||
StorageDead(_4); // scope 0 at $DIR/repeat.rs:+1:32: +1:33
|
||||
StorageDead(_3); // scope 0 at $DIR/repeat.rs:+1:32: +1:33
|
||||
_0 = const (); // scope 0 at $DIR/repeat.rs:+0:11: +2:2
|
||||
StorageDead(_1); // scope 0 at $DIR/repeat.rs:+2:1: +2:2
|
||||
return; // scope 0 at $DIR/repeat.rs:+2:2: +2:2
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +0,0 @@
|
||||
// unit-test: DataflowConstProp
|
||||
|
||||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||
// EMIT_MIR repeat.main.DataflowConstProp.diff
|
||||
fn main() {
|
||||
let x: u32 = [42; 8][2] + 0;
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
- // MIR for `add` before DataflowConstProp
|
||||
+ // MIR for `add` after DataflowConstProp
|
||||
|
||||
fn add() -> u32 {
|
||||
let mut _0: u32; // return place in scope 0 at $DIR/return_place.rs:+0:13: +0:16
|
||||
let mut _1: (u32, bool); // in scope 0 at $DIR/return_place.rs:+1:5: +1:10
|
||||
|
||||
bb0: {
|
||||
_1 = CheckedAdd(const 2_u32, const 2_u32); // scope 0 at $DIR/return_place.rs:+1:5: +1:10
|
||||
- assert(!move (_1.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_u32, const 2_u32) -> bb1; // scope 0 at $DIR/return_place.rs:+1:5: +1:10
|
||||
+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_u32, const 2_u32) -> bb1; // scope 0 at $DIR/return_place.rs:+1:5: +1:10
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- _0 = move (_1.0: u32); // scope 0 at $DIR/return_place.rs:+1:5: +1:10
|
||||
+ _0 = const 4_u32; // scope 0 at $DIR/return_place.rs:+1:5: +1:10
|
||||
return; // scope 0 at $DIR/return_place.rs:+2:2: +2:2
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +0,0 @@
|
||||
// MIR for `add` before PreCodegen
|
||||
|
||||
fn add() -> u32 {
|
||||
let mut _0: u32; // return place in scope 0 at $DIR/return_place.rs:+0:13: +0:16
|
||||
let mut _1: (u32, bool); // in scope 0 at $DIR/return_place.rs:+1:5: +1:10
|
||||
|
||||
bb0: {
|
||||
_1 = CheckedAdd(const 2_u32, const 2_u32); // scope 0 at $DIR/return_place.rs:+1:5: +1:10
|
||||
assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_u32, const 2_u32) -> bb1; // scope 0 at $DIR/return_place.rs:+1:5: +1:10
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_0 = const 4_u32; // scope 0 at $DIR/return_place.rs:+1:5: +1:10
|
||||
return; // scope 0 at $DIR/return_place.rs:+2:2: +2:2
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
// unit-test: DataflowConstProp
|
||||
// compile-flags: -C overflow-checks=on
|
||||
|
||||
// EMIT_MIR return_place.add.DataflowConstProp.diff
|
||||
// EMIT_MIR return_place.add.PreCodegen.before.mir
|
||||
fn add() -> u32 {
|
||||
2 + 2
|
||||
}
|
||||
|
||||
fn main() {
|
||||
add();
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/scalar_literal_propagation.rs:+0:11: +0:11
|
||||
let _1: u32; // in scope 0 at $DIR/scalar_literal_propagation.rs:+1:9: +1:10
|
||||
let _2: (); // in scope 0 at $DIR/scalar_literal_propagation.rs:+2:5: +2:15
|
||||
let mut _3: u32; // in scope 0 at $DIR/scalar_literal_propagation.rs:+2:13: +2:14
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/scalar_literal_propagation.rs:+1:9: +1:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/scalar_literal_propagation.rs:+1:9: +1:10
|
||||
_1 = const 1_u32; // scope 0 at $DIR/scalar_literal_propagation.rs:+1:13: +1:14
|
||||
StorageLive(_2); // scope 1 at $DIR/scalar_literal_propagation.rs:+2:5: +2:15
|
||||
StorageLive(_3); // scope 1 at $DIR/scalar_literal_propagation.rs:+2:13: +2:14
|
||||
- _3 = _1; // scope 1 at $DIR/scalar_literal_propagation.rs:+2:13: +2:14
|
||||
- _2 = consume(move _3) -> bb1; // scope 1 at $DIR/scalar_literal_propagation.rs:+2:5: +2:15
|
||||
+ _3 = const 1_u32; // scope 1 at $DIR/scalar_literal_propagation.rs:+2:13: +2:14
|
||||
+ _2 = consume(const 1_u32) -> bb1; // scope 1 at $DIR/scalar_literal_propagation.rs:+2:5: +2:15
|
||||
// mir::Constant
|
||||
// + span: $DIR/scalar_literal_propagation.rs:5:5: 5:12
|
||||
// + literal: Const { ty: fn(u32) {consume}, val: Value(<ZST>) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageDead(_3); // scope 1 at $DIR/scalar_literal_propagation.rs:+2:14: +2:15
|
||||
StorageDead(_2); // scope 1 at $DIR/scalar_literal_propagation.rs:+2:15: +2:16
|
||||
_0 = const (); // scope 0 at $DIR/scalar_literal_propagation.rs:+0:11: +3:2
|
||||
StorageDead(_1); // scope 0 at $DIR/scalar_literal_propagation.rs:+3:1: +3:2
|
||||
return; // scope 0 at $DIR/scalar_literal_propagation.rs:+3:2: +3:2
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +0,0 @@
|
||||
// unit-test: DataflowConstProp
|
||||
// EMIT_MIR scalar_literal_propagation.main.DataflowConstProp.diff
|
||||
fn main() {
|
||||
let x = 1;
|
||||
consume(x);
|
||||
}
|
||||
|
||||
#[inline(never)]
|
||||
fn consume(_: u32) {}
|
@ -1,48 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/slice_len.rs:+0:11: +0:11
|
||||
let _1: u32; // in scope 0 at $DIR/slice_len.rs:+1:5: +1:33
|
||||
let mut _2: &[u32]; // in scope 0 at $DIR/slice_len.rs:+1:5: +1:30
|
||||
let mut _3: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:+1:6: +1:19
|
||||
let _4: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:+1:6: +1:19
|
||||
let _5: [u32; 3]; // in scope 0 at $DIR/slice_len.rs:+1:7: +1:19
|
||||
let _6: usize; // in scope 0 at $DIR/slice_len.rs:+1:31: +1:32
|
||||
let mut _7: usize; // in scope 0 at $DIR/slice_len.rs:+1:5: +1:33
|
||||
let mut _8: bool; // in scope 0 at $DIR/slice_len.rs:+1:5: +1:33
|
||||
let mut _9: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:+1:6: +1:19
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
|
||||
StorageLive(_2); // scope 0 at $DIR/slice_len.rs:+1:5: +1:30
|
||||
StorageLive(_3); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19
|
||||
StorageLive(_4); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19
|
||||
_9 = const _; // scope 0 at $DIR/slice_len.rs:+1:6: +1:19
|
||||
// mir::Constant
|
||||
// + span: $DIR/slice_len.rs:6:6: 6:19
|
||||
// + literal: Const { ty: &[u32; 3], val: Unevaluated(main, [], Some(promoted[0])) }
|
||||
_4 = &(*_9); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19
|
||||
_3 = &(*_4); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19
|
||||
_2 = move _3 as &[u32] (Pointer(Unsize)); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19
|
||||
StorageDead(_3); // scope 0 at $DIR/slice_len.rs:+1:18: +1:19
|
||||
StorageLive(_6); // scope 0 at $DIR/slice_len.rs:+1:31: +1:32
|
||||
_6 = const 1_usize; // scope 0 at $DIR/slice_len.rs:+1:31: +1:32
|
||||
_7 = Len((*_2)); // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
|
||||
- _8 = Lt(_6, _7); // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
|
||||
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
|
||||
+ _8 = Lt(const 1_usize, _7); // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
|
||||
+ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 1_usize) -> bb1; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_1 = (*_2)[_6]; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
|
||||
StorageDead(_6); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34
|
||||
StorageDead(_4); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34
|
||||
StorageDead(_2); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34
|
||||
StorageDead(_1); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34
|
||||
_0 = const (); // scope 0 at $DIR/slice_len.rs:+0:11: +2:2
|
||||
return; // scope 0 at $DIR/slice_len.rs:+2:2: +2:2
|
||||
}
|
||||
}
|
||||
|
@ -1,48 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/slice_len.rs:+0:11: +0:11
|
||||
let _1: u32; // in scope 0 at $DIR/slice_len.rs:+1:5: +1:33
|
||||
let mut _2: &[u32]; // in scope 0 at $DIR/slice_len.rs:+1:5: +1:30
|
||||
let mut _3: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:+1:6: +1:19
|
||||
let _4: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:+1:6: +1:19
|
||||
let _5: [u32; 3]; // in scope 0 at $DIR/slice_len.rs:+1:7: +1:19
|
||||
let _6: usize; // in scope 0 at $DIR/slice_len.rs:+1:31: +1:32
|
||||
let mut _7: usize; // in scope 0 at $DIR/slice_len.rs:+1:5: +1:33
|
||||
let mut _8: bool; // in scope 0 at $DIR/slice_len.rs:+1:5: +1:33
|
||||
let mut _9: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:+1:6: +1:19
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
|
||||
StorageLive(_2); // scope 0 at $DIR/slice_len.rs:+1:5: +1:30
|
||||
StorageLive(_3); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19
|
||||
StorageLive(_4); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19
|
||||
_9 = const _; // scope 0 at $DIR/slice_len.rs:+1:6: +1:19
|
||||
// mir::Constant
|
||||
// + span: $DIR/slice_len.rs:6:6: 6:19
|
||||
// + literal: Const { ty: &[u32; 3], val: Unevaluated(main, [], Some(promoted[0])) }
|
||||
_4 = &(*_9); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19
|
||||
_3 = &(*_4); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19
|
||||
_2 = move _3 as &[u32] (Pointer(Unsize)); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19
|
||||
StorageDead(_3); // scope 0 at $DIR/slice_len.rs:+1:18: +1:19
|
||||
StorageLive(_6); // scope 0 at $DIR/slice_len.rs:+1:31: +1:32
|
||||
_6 = const 1_usize; // scope 0 at $DIR/slice_len.rs:+1:31: +1:32
|
||||
_7 = Len((*_2)); // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
|
||||
- _8 = Lt(_6, _7); // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
|
||||
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
|
||||
+ _8 = Lt(const 1_usize, _7); // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
|
||||
+ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 1_usize) -> bb1; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_1 = (*_2)[_6]; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
|
||||
StorageDead(_6); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34
|
||||
StorageDead(_4); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34
|
||||
StorageDead(_2); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34
|
||||
StorageDead(_1); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34
|
||||
_0 = const (); // scope 0 at $DIR/slice_len.rs:+0:11: +2:2
|
||||
return; // scope 0 at $DIR/slice_len.rs:+2:2: +2:2
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +0,0 @@
|
||||
// unit-test: DataflowConstProp
|
||||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||
|
||||
// EMIT_MIR slice_len.main.DataflowConstProp.diff
|
||||
fn main() {
|
||||
(&[1u32, 2, 3] as &[u32])[1];
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/switch_int.rs:+0:11: +0:11
|
||||
let mut _1: i32; // in scope 0 at $DIR/switch_int.rs:+1:11: +1:12
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/switch_int.rs:+1:11: +1:12
|
||||
_1 = const 1_i32; // scope 0 at $DIR/switch_int.rs:+1:11: +1:12
|
||||
switchInt(const 1_i32) -> [1_i32: bb2, otherwise: bb1]; // scope 0 at $DIR/switch_int.rs:+1:5: +1:12
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_0 = foo(const -1_i32) -> bb3; // scope 0 at $DIR/switch_int.rs:+3:14: +3:21
|
||||
// mir::Constant
|
||||
// + span: $DIR/switch_int.rs:9:14: 9:17
|
||||
// + literal: Const { ty: fn(i32) {foo}, val: Value(<ZST>) }
|
||||
}
|
||||
|
||||
bb2: {
|
||||
_0 = foo(const 0_i32) -> bb3; // scope 0 at $DIR/switch_int.rs:+2:14: +2:20
|
||||
// mir::Constant
|
||||
// + span: $DIR/switch_int.rs:8:14: 8:17
|
||||
// + literal: Const { ty: fn(i32) {foo}, val: Value(<ZST>) }
|
||||
}
|
||||
|
||||
bb3: {
|
||||
StorageDead(_1); // scope 0 at $DIR/switch_int.rs:+5:1: +5:2
|
||||
return; // scope 0 at $DIR/switch_int.rs:+5:2: +5:2
|
||||
}
|
||||
}
|
||||
|
@ -1,34 +0,0 @@
|
||||
- // MIR for `main` before SimplifyConstCondition-after-const-prop
|
||||
+ // MIR for `main` after SimplifyConstCondition-after-const-prop
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/switch_int.rs:+0:11: +0:11
|
||||
let mut _1: i32; // in scope 0 at $DIR/switch_int.rs:+1:11: +1:12
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/switch_int.rs:+1:11: +1:12
|
||||
_1 = const 1_i32; // scope 0 at $DIR/switch_int.rs:+1:11: +1:12
|
||||
- switchInt(const 1_i32) -> [1_i32: bb2, otherwise: bb1]; // scope 0 at $DIR/switch_int.rs:+1:5: +1:12
|
||||
+ goto -> bb2; // scope 0 at $DIR/switch_int.rs:+1:5: +1:12
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_0 = foo(const -1_i32) -> bb3; // scope 0 at $DIR/switch_int.rs:+3:14: +3:21
|
||||
// mir::Constant
|
||||
// + span: $DIR/switch_int.rs:9:14: 9:17
|
||||
// + literal: Const { ty: fn(i32) {foo}, val: Value(<ZST>) }
|
||||
}
|
||||
|
||||
bb2: {
|
||||
_0 = foo(const 0_i32) -> bb3; // scope 0 at $DIR/switch_int.rs:+2:14: +2:20
|
||||
// mir::Constant
|
||||
// + span: $DIR/switch_int.rs:8:14: 8:17
|
||||
// + literal: Const { ty: fn(i32) {foo}, val: Value(<ZST>) }
|
||||
}
|
||||
|
||||
bb3: {
|
||||
StorageDead(_1); // scope 0 at $DIR/switch_int.rs:+5:1: +5:2
|
||||
return; // scope 0 at $DIR/switch_int.rs:+5:2: +5:2
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +0,0 @@
|
||||
#[inline(never)]
|
||||
fn foo(_: i32) {}
|
||||
|
||||
// EMIT_MIR switch_int.main.DataflowConstProp.diff
|
||||
// EMIT_MIR switch_int.main.SimplifyConstCondition-after-const-prop.diff
|
||||
fn main() {
|
||||
match 1 {
|
||||
1 => foo(0),
|
||||
_ => foo(-1),
|
||||
}
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/tuple_literal_propagation.rs:+0:11: +0:11
|
||||
let _1: (u32, u32); // in scope 0 at $DIR/tuple_literal_propagation.rs:+1:9: +1:10
|
||||
let _2: (); // in scope 0 at $DIR/tuple_literal_propagation.rs:+3:5: +3:15
|
||||
let mut _3: (u32, u32); // in scope 0 at $DIR/tuple_literal_propagation.rs:+3:13: +3:14
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/tuple_literal_propagation.rs:+1:9: +1:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/tuple_literal_propagation.rs:+1:9: +1:10
|
||||
Deinit(_1); // scope 0 at $DIR/tuple_literal_propagation.rs:+1:13: +1:19
|
||||
(_1.0: u32) = const 1_u32; // scope 0 at $DIR/tuple_literal_propagation.rs:+1:13: +1:19
|
||||
(_1.1: u32) = const 2_u32; // scope 0 at $DIR/tuple_literal_propagation.rs:+1:13: +1:19
|
||||
StorageLive(_2); // scope 1 at $DIR/tuple_literal_propagation.rs:+3:5: +3:15
|
||||
StorageLive(_3); // scope 1 at $DIR/tuple_literal_propagation.rs:+3:13: +3:14
|
||||
_3 = _1; // scope 1 at $DIR/tuple_literal_propagation.rs:+3:13: +3:14
|
||||
_2 = consume(move _3) -> bb1; // scope 1 at $DIR/tuple_literal_propagation.rs:+3:5: +3:15
|
||||
// mir::Constant
|
||||
// + span: $DIR/tuple_literal_propagation.rs:6:5: 6:12
|
||||
// + literal: Const { ty: fn((u32, u32)) {consume}, val: Value(<ZST>) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageDead(_3); // scope 1 at $DIR/tuple_literal_propagation.rs:+3:14: +3:15
|
||||
StorageDead(_2); // scope 1 at $DIR/tuple_literal_propagation.rs:+3:15: +3:16
|
||||
_0 = const (); // scope 0 at $DIR/tuple_literal_propagation.rs:+0:11: +4:2
|
||||
StorageDead(_1); // scope 0 at $DIR/tuple_literal_propagation.rs:+4:1: +4:2
|
||||
return; // scope 0 at $DIR/tuple_literal_propagation.rs:+4:2: +4:2
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +0,0 @@
|
||||
// unit-test: DataflowConstProp
|
||||
// EMIT_MIR tuple_literal_propagation.main.DataflowConstProp.diff
|
||||
fn main() {
|
||||
let x = (1, 2);
|
||||
|
||||
consume(x);
|
||||
}
|
||||
|
||||
#[inline(never)]
|
||||
fn consume(_: (u32, u32)) {}
|
@ -16,7 +16,7 @@
|
||||
StorageLive(_2); // scope 0 at $DIR/promoted.rs:+2:14: +2:17
|
||||
_4 = const _; // scope 0 at $DIR/promoted.rs:+2:14: +2:17
|
||||
// mir::Constant
|
||||
// + span: $DIR/promoted.rs:6:14: 6:17
|
||||
// + span: $DIR/promoted.rs:7:14: 7:17
|
||||
// + literal: Const { ty: &i32, val: Unevaluated(main, [], Some(promoted[0])) }
|
||||
_2 = &(*_4); // scope 0 at $DIR/promoted.rs:+2:14: +2:17
|
||||
_1 = (*_2); // scope 0 at $DIR/promoted.rs:+2:13: +2:17
|
||||
|
@ -1,4 +1,5 @@
|
||||
// unit-test: DataflowConstProp
|
||||
// compile-flags: -Zunsound-mir-opts
|
||||
|
||||
// EMIT_MIR promoted.main.DataflowConstProp.diff
|
||||
fn main() {
|
||||
|
@ -1,132 +0,0 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/recursive.rs:+0:11: +0:11
|
||||
let _1: S<'_>; // in scope 0 at $DIR/recursive.rs:+2:9: +2:10
|
||||
let mut _3: &S<'_>; // in scope 0 at $DIR/recursive.rs:+3:20: +3:22
|
||||
let _4: &S<'_>; // in scope 0 at $DIR/recursive.rs:+3:20: +3:22
|
||||
let mut _6: &S<'_>; // in scope 0 at $DIR/recursive.rs:+4:20: +4:22
|
||||
let _7: &S<'_>; // in scope 0 at $DIR/recursive.rs:+4:20: +4:22
|
||||
let mut _9: isize; // in scope 0 at $DIR/recursive.rs:+6:9: +6:18
|
||||
let mut _11: isize; // in scope 0 at $DIR/recursive.rs:+7:13: +7:22
|
||||
let mut _13: isize; // in scope 0 at $DIR/recursive.rs:+8:17: +8:28
|
||||
let mut _15: !; // in scope 0 at $DIR/recursive.rs:+9:22: +9:43
|
||||
let mut _16: !; // in scope 0 at $DIR/recursive.rs:+11:18: +11:39
|
||||
let mut _17: !; // in scope 0 at $DIR/recursive.rs:+13:14: +13:35
|
||||
let mut _18: &S<'_>; // in scope 0 at $DIR/recursive.rs:+7:20: +7:21
|
||||
let mut _19: &S<'_>; // in scope 0 at $DIR/recursive.rs:+7:20: +7:21
|
||||
scope 1 {
|
||||
debug a => _1; // in scope 1 at $DIR/recursive.rs:+2:9: +2:10
|
||||
let _2: S<'_>; // in scope 1 at $DIR/recursive.rs:+3:9: +3:10
|
||||
scope 2 {
|
||||
debug b => _2; // in scope 2 at $DIR/recursive.rs:+3:9: +3:10
|
||||
let _5: S<'_>; // in scope 2 at $DIR/recursive.rs:+4:9: +4:10
|
||||
scope 3 {
|
||||
debug c => _5; // in scope 3 at $DIR/recursive.rs:+4:9: +4:10
|
||||
let _8: u32; // in scope 3 at $DIR/recursive.rs:+5:9: +5:10
|
||||
let _10: &S<'_>; // in scope 3 at $DIR/recursive.rs:+6:16: +6:17
|
||||
scope 4 {
|
||||
debug d => _8; // in scope 4 at $DIR/recursive.rs:+5:9: +5:10
|
||||
}
|
||||
scope 5 {
|
||||
debug b => _10; // in scope 5 at $DIR/recursive.rs:+6:16: +6:17
|
||||
let _12: &&S<'_>; // in scope 5 at $DIR/recursive.rs:+7:20: +7:21
|
||||
scope 6 {
|
||||
debug a => _12; // in scope 6 at $DIR/recursive.rs:+7:20: +7:21
|
||||
let _14: &u32; // in scope 6 at $DIR/recursive.rs:+8:24: +8:27
|
||||
scope 7 {
|
||||
debug num => _14; // in scope 7 at $DIR/recursive.rs:+8:24: +8:27
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/recursive.rs:+2:9: +2:10
|
||||
Deinit(_1); // scope 0 at $DIR/recursive.rs:+2:13: +2:22
|
||||
((_1 as Num).0: u32) = const 0_u32; // scope 0 at $DIR/recursive.rs:+2:13: +2:22
|
||||
discriminant(_1) = 1; // scope 0 at $DIR/recursive.rs:+2:13: +2:22
|
||||
StorageLive(_2); // scope 1 at $DIR/recursive.rs:+3:9: +3:10
|
||||
StorageLive(_3); // scope 1 at $DIR/recursive.rs:+3:20: +3:22
|
||||
StorageLive(_4); // scope 1 at $DIR/recursive.rs:+3:20: +3:22
|
||||
_4 = &_1; // scope 1 at $DIR/recursive.rs:+3:20: +3:22
|
||||
_3 = &(*_4); // scope 1 at $DIR/recursive.rs:+3:20: +3:22
|
||||
Deinit(_2); // scope 1 at $DIR/recursive.rs:+3:13: +3:23
|
||||
((_2 as Rec).0: &S<'_>) = move _3; // scope 1 at $DIR/recursive.rs:+3:13: +3:23
|
||||
discriminant(_2) = 0; // scope 1 at $DIR/recursive.rs:+3:13: +3:23
|
||||
StorageDead(_3); // scope 1 at $DIR/recursive.rs:+3:22: +3:23
|
||||
StorageDead(_4); // scope 1 at $DIR/recursive.rs:+3:23: +3:24
|
||||
StorageLive(_5); // scope 2 at $DIR/recursive.rs:+4:9: +4:10
|
||||
StorageLive(_6); // scope 2 at $DIR/recursive.rs:+4:20: +4:22
|
||||
StorageLive(_7); // scope 2 at $DIR/recursive.rs:+4:20: +4:22
|
||||
_7 = &_2; // scope 2 at $DIR/recursive.rs:+4:20: +4:22
|
||||
_6 = &(*_7); // scope 2 at $DIR/recursive.rs:+4:20: +4:22
|
||||
Deinit(_5); // scope 2 at $DIR/recursive.rs:+4:13: +4:23
|
||||
((_5 as Rec).0: &S<'_>) = move _6; // scope 2 at $DIR/recursive.rs:+4:13: +4:23
|
||||
discriminant(_5) = 0; // scope 2 at $DIR/recursive.rs:+4:13: +4:23
|
||||
StorageDead(_6); // scope 2 at $DIR/recursive.rs:+4:22: +4:23
|
||||
StorageDead(_7); // scope 2 at $DIR/recursive.rs:+4:23: +4:24
|
||||
StorageLive(_8); // scope 3 at $DIR/recursive.rs:+5:9: +5:10
|
||||
_9 = discriminant(_5); // scope 3 at $DIR/recursive.rs:+5:19: +5:20
|
||||
switchInt(move _9) -> [0_isize: bb2, otherwise: bb1]; // scope 3 at $DIR/recursive.rs:+5:13: +5:20
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageLive(_17); // scope 3 at $DIR/recursive.rs:+13:14: +13:35
|
||||
_17 = exit(const 0_i32); // scope 3 at $DIR/recursive.rs:+13:14: +13:35
|
||||
// mir::Constant
|
||||
// + span: $DIR/recursive.rs:22:14: 22:32
|
||||
// + literal: Const { ty: fn(i32) -> ! {exit}, val: Value(<ZST>) }
|
||||
}
|
||||
|
||||
bb2: {
|
||||
StorageLive(_10); // scope 3 at $DIR/recursive.rs:+6:16: +6:17
|
||||
_10 = ((_5 as Rec).0: &S<'_>); // scope 3 at $DIR/recursive.rs:+6:16: +6:17
|
||||
_11 = discriminant((*_10)); // scope 5 at $DIR/recursive.rs:+6:28: +6:29
|
||||
switchInt(move _11) -> [0_isize: bb4, otherwise: bb3]; // scope 5 at $DIR/recursive.rs:+6:22: +6:29
|
||||
}
|
||||
|
||||
bb3: {
|
||||
StorageLive(_16); // scope 5 at $DIR/recursive.rs:+11:18: +11:39
|
||||
_16 = exit(const 0_i32); // scope 5 at $DIR/recursive.rs:+11:18: +11:39
|
||||
// mir::Constant
|
||||
// + span: $DIR/recursive.rs:20:18: 20:36
|
||||
// + literal: Const { ty: fn(i32) -> ! {exit}, val: Value(<ZST>) }
|
||||
}
|
||||
|
||||
bb4: {
|
||||
StorageLive(_12); // scope 5 at $DIR/recursive.rs:+7:20: +7:21
|
||||
_12 = &(((*_10) as Rec).0: &S<'_>); // scope 5 at $DIR/recursive.rs:+7:20: +7:21
|
||||
_18 = deref_copy (*_12); // scope 6 at $DIR/recursive.rs:+7:32: +7:33
|
||||
_13 = discriminant((*_18)); // scope 6 at $DIR/recursive.rs:+7:32: +7:33
|
||||
switchInt(move _13) -> [1_isize: bb6, otherwise: bb5]; // scope 6 at $DIR/recursive.rs:+7:26: +7:33
|
||||
}
|
||||
|
||||
bb5: {
|
||||
StorageLive(_15); // scope 6 at $DIR/recursive.rs:+9:22: +9:43
|
||||
_15 = exit(const 0_i32); // scope 6 at $DIR/recursive.rs:+9:22: +9:43
|
||||
// mir::Constant
|
||||
// + span: $DIR/recursive.rs:18:22: 18:40
|
||||
// + literal: Const { ty: fn(i32) -> ! {exit}, val: Value(<ZST>) }
|
||||
}
|
||||
|
||||
bb6: {
|
||||
StorageLive(_14); // scope 6 at $DIR/recursive.rs:+8:24: +8:27
|
||||
_19 = deref_copy (*_12); // scope 6 at $DIR/recursive.rs:+8:24: +8:27
|
||||
_14 = &(((*_19) as Num).0: u32); // scope 6 at $DIR/recursive.rs:+8:24: +8:27
|
||||
_8 = (*_14); // scope 7 at $DIR/recursive.rs:+8:32: +8:36
|
||||
StorageDead(_14); // scope 6 at $DIR/recursive.rs:+8:35: +8:36
|
||||
StorageDead(_12); // scope 5 at $DIR/recursive.rs:+10:13: +10:14
|
||||
StorageDead(_10); // scope 3 at $DIR/recursive.rs:+12:9: +12:10
|
||||
_0 = const (); // scope 0 at $DIR/recursive.rs:+0:11: +15:2
|
||||
StorageDead(_8); // scope 3 at $DIR/recursive.rs:+15:1: +15:2
|
||||
StorageDead(_5); // scope 2 at $DIR/recursive.rs:+15:1: +15:2
|
||||
StorageDead(_2); // scope 1 at $DIR/recursive.rs:+15:1: +15:2
|
||||
StorageDead(_1); // scope 0 at $DIR/recursive.rs:+15:1: +15:2
|
||||
return; // scope 0 at $DIR/recursive.rs:+15:2: +15:2
|
||||
}
|
||||
}
|
||||
|
@ -1,24 +0,0 @@
|
||||
// unit-test: DataflowConstProp
|
||||
|
||||
enum S<'a> {
|
||||
Rec(&'a S<'a>),
|
||||
Num(u32),
|
||||
}
|
||||
|
||||
// EMIT_MIR recursive.main.DataflowConstProp.diff
|
||||
fn main() {
|
||||
// FIXME: This currently does not work, because downcasts are rejected.
|
||||
let a = S::Num(0);
|
||||
let b = S::Rec(&a);
|
||||
let c = S::Rec(&b);
|
||||
let d = match c {
|
||||
S::Rec(b) => match b {
|
||||
S::Rec(a) => match a {
|
||||
S::Num(num) => *num,
|
||||
_ => std::process::exit(0),
|
||||
},
|
||||
_ => std::process::exit(0),
|
||||
},
|
||||
_ => std::process::exit(0),
|
||||
};
|
||||
}
|
@ -54,7 +54,7 @@
|
||||
StorageLive(_8); // scope 6 at $DIR/ref_mut.rs:+9:10: +9:12
|
||||
_11 = const _; // scope 6 at $DIR/ref_mut.rs:+9:10: +9:12
|
||||
// mir::Constant
|
||||
// + span: $DIR/ref_mut.rs:13:10: 13:12
|
||||
// + span: $DIR/ref_mut.rs:14:10: 14:12
|
||||
// + literal: Const { ty: &i32, val: Unevaluated(main, [], Some(promoted[0])) }
|
||||
_8 = &(*_11); // scope 6 at $DIR/ref_mut.rs:+9:10: +9:12
|
||||
_7 = &(*_8); // scope 6 at $DIR/ref_mut.rs:+9:10: +9:12
|
||||
|
@ -1,4 +1,5 @@
|
||||
// unit-test: DataflowConstProp
|
||||
// compile-flags: -Zunsound-mir-opts
|
||||
|
||||
// EMIT_MIR ref_mut.main.DataflowConstProp.diff
|
||||
fn main() {
|
||||
|
@ -0,0 +1,52 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/self_assign.rs:+0:11: +0:11
|
||||
let mut _1: i32; // in scope 0 at $DIR/self_assign.rs:+1:9: +1:14
|
||||
let mut _2: i32; // in scope 0 at $DIR/self_assign.rs:+2:9: +2:10
|
||||
let mut _3: i32; // in scope 0 at $DIR/self_assign.rs:+3:9: +3:10
|
||||
let mut _5: &i32; // in scope 0 at $DIR/self_assign.rs:+6:9: +6:10
|
||||
let mut _6: i32; // in scope 0 at $DIR/self_assign.rs:+7:9: +7:11
|
||||
scope 1 {
|
||||
debug a => _1; // in scope 1 at $DIR/self_assign.rs:+1:9: +1:14
|
||||
let mut _4: &i32; // in scope 1 at $DIR/self_assign.rs:+5:9: +5:14
|
||||
scope 2 {
|
||||
debug b => _4; // in scope 2 at $DIR/self_assign.rs:+5:9: +5:14
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/self_assign.rs:+1:9: +1:14
|
||||
_1 = const 0_i32; // scope 0 at $DIR/self_assign.rs:+1:17: +1:18
|
||||
StorageLive(_2); // scope 1 at $DIR/self_assign.rs:+2:9: +2:10
|
||||
- _2 = _1; // scope 1 at $DIR/self_assign.rs:+2:9: +2:10
|
||||
- _1 = Add(move _2, const 1_i32); // scope 1 at $DIR/self_assign.rs:+2:5: +2:14
|
||||
+ _2 = const 0_i32; // scope 1 at $DIR/self_assign.rs:+2:9: +2:10
|
||||
+ _1 = const 1_i32; // scope 1 at $DIR/self_assign.rs:+2:5: +2:14
|
||||
StorageDead(_2); // scope 1 at $DIR/self_assign.rs:+2:13: +2:14
|
||||
StorageLive(_3); // scope 1 at $DIR/self_assign.rs:+3:9: +3:10
|
||||
- _3 = _1; // scope 1 at $DIR/self_assign.rs:+3:9: +3:10
|
||||
- _1 = move _3; // scope 1 at $DIR/self_assign.rs:+3:5: +3:10
|
||||
+ _3 = const 1_i32; // scope 1 at $DIR/self_assign.rs:+3:9: +3:10
|
||||
+ _1 = const 1_i32; // scope 1 at $DIR/self_assign.rs:+3:5: +3:10
|
||||
StorageDead(_3); // scope 1 at $DIR/self_assign.rs:+3:9: +3:10
|
||||
StorageLive(_4); // scope 1 at $DIR/self_assign.rs:+5:9: +5:14
|
||||
_4 = &_1; // scope 1 at $DIR/self_assign.rs:+5:17: +5:19
|
||||
StorageLive(_5); // scope 2 at $DIR/self_assign.rs:+6:9: +6:10
|
||||
_5 = _4; // scope 2 at $DIR/self_assign.rs:+6:9: +6:10
|
||||
_4 = move _5; // scope 2 at $DIR/self_assign.rs:+6:5: +6:10
|
||||
StorageDead(_5); // scope 2 at $DIR/self_assign.rs:+6:9: +6:10
|
||||
StorageLive(_6); // scope 2 at $DIR/self_assign.rs:+7:9: +7:11
|
||||
- _6 = (*_4); // scope 2 at $DIR/self_assign.rs:+7:9: +7:11
|
||||
- _1 = move _6; // scope 2 at $DIR/self_assign.rs:+7:5: +7:11
|
||||
+ _6 = const 1_i32; // scope 2 at $DIR/self_assign.rs:+7:9: +7:11
|
||||
+ _1 = const 1_i32; // scope 2 at $DIR/self_assign.rs:+7:5: +7:11
|
||||
StorageDead(_6); // scope 2 at $DIR/self_assign.rs:+7:10: +7:11
|
||||
_0 = const (); // scope 0 at $DIR/self_assign.rs:+0:11: +8:2
|
||||
StorageDead(_4); // scope 1 at $DIR/self_assign.rs:+8:1: +8:2
|
||||
StorageDead(_1); // scope 0 at $DIR/self_assign.rs:+8:1: +8:2
|
||||
return; // scope 0 at $DIR/self_assign.rs:+8:2: +8:2
|
||||
}
|
||||
}
|
||||
|
13
src/test/mir-opt/dataflow-const-prop/self_assign.rs
Normal file
13
src/test/mir-opt/dataflow-const-prop/self_assign.rs
Normal file
@ -0,0 +1,13 @@
|
||||
// unit-test: DataflowConstProp
|
||||
// compile-flags: -Zunsound-mir-opts
|
||||
|
||||
// EMIT_MIR self_assign.main.DataflowConstProp.diff
|
||||
fn main() {
|
||||
let mut a = 0;
|
||||
a = a + 1;
|
||||
a = a;
|
||||
|
||||
let mut b = &a;
|
||||
b = b;
|
||||
a = *b;
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
- // MIR for `main` before DataflowConstProp
|
||||
+ // MIR for `main` after DataflowConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/self_assign_add.rs:+0:11: +0:11
|
||||
let mut _1: i32; // in scope 0 at $DIR/self_assign_add.rs:+1:9: +1:14
|
||||
scope 1 {
|
||||
debug a => _1; // in scope 1 at $DIR/self_assign_add.rs:+1:9: +1:14
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/self_assign_add.rs:+1:9: +1:14
|
||||
_1 = const 0_i32; // scope 0 at $DIR/self_assign_add.rs:+1:17: +1:18
|
||||
- _1 = Add(_1, const 1_i32); // scope 1 at $DIR/self_assign_add.rs:+2:5: +2:11
|
||||
- _1 = Add(_1, const 1_i32); // scope 1 at $DIR/self_assign_add.rs:+3:5: +3:11
|
||||
+ _1 = const 1_i32; // scope 1 at $DIR/self_assign_add.rs:+2:5: +2:11
|
||||
+ _1 = const 2_i32; // scope 1 at $DIR/self_assign_add.rs:+3:5: +3:11
|
||||
_0 = const (); // scope 0 at $DIR/self_assign_add.rs:+0:11: +4:2
|
||||
StorageDead(_1); // scope 0 at $DIR/self_assign_add.rs:+4:1: +4:2
|
||||
return; // scope 0 at $DIR/self_assign_add.rs:+4:2: +4:2
|
||||
}
|
||||
}
|
||||
|
9
src/test/mir-opt/dataflow-const-prop/self_assign_add.rs
Normal file
9
src/test/mir-opt/dataflow-const-prop/self_assign_add.rs
Normal file
@ -0,0 +1,9 @@
|
||||
// unit-test: DataflowConstProp
|
||||
// compile-flags: -Zunsound-mir-opts
|
||||
|
||||
// EMIT_MIR self_assign_add.main.DataflowConstProp.diff
|
||||
fn main() {
|
||||
let mut a = 0;
|
||||
a += 1;
|
||||
a += 1;
|
||||
}
|
@ -3,47 +3,47 @@
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/static_ref.rs:+0:11: +0:11
|
||||
let _1: i32; // in scope 0 at $DIR/static_ref.rs:+2:9: +2:10
|
||||
let mut _3: &i32; // in scope 0 at $DIR/static_ref.rs:+4:9: +4:11
|
||||
let _4: &i32; // in scope 0 at $DIR/static_ref.rs:+4:9: +4:11
|
||||
let _5: &i32; // in scope 0 at $DIR/static_ref.rs:+4:10: +4:11
|
||||
let _1: i32; // in scope 0 at $DIR/static_ref.rs:+3:9: +3:10
|
||||
let mut _3: &i32; // in scope 0 at $DIR/static_ref.rs:+5:9: +5:11
|
||||
let _4: &i32; // in scope 0 at $DIR/static_ref.rs:+5:9: +5:11
|
||||
let _5: &i32; // in scope 0 at $DIR/static_ref.rs:+5:10: +5:11
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/static_ref.rs:+2:9: +2:10
|
||||
let mut _2: &i32; // in scope 1 at $DIR/static_ref.rs:+3:9: +3:14
|
||||
debug x => _1; // in scope 1 at $DIR/static_ref.rs:+3:9: +3:10
|
||||
let mut _2: &i32; // in scope 1 at $DIR/static_ref.rs:+4:9: +4:14
|
||||
scope 2 {
|
||||
debug r => _2; // in scope 2 at $DIR/static_ref.rs:+3:9: +3:14
|
||||
let _6: i32; // in scope 2 at $DIR/static_ref.rs:+5:9: +5:10
|
||||
debug r => _2; // in scope 2 at $DIR/static_ref.rs:+4:9: +4:14
|
||||
let _6: i32; // in scope 2 at $DIR/static_ref.rs:+6:9: +6:10
|
||||
scope 3 {
|
||||
debug y => _6; // in scope 3 at $DIR/static_ref.rs:+5:9: +5:10
|
||||
debug y => _6; // in scope 3 at $DIR/static_ref.rs:+6:9: +6:10
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/static_ref.rs:+2:9: +2:10
|
||||
_1 = const 0_i32; // scope 0 at $DIR/static_ref.rs:+2:13: +2:14
|
||||
StorageLive(_2); // scope 1 at $DIR/static_ref.rs:+3:9: +3:14
|
||||
_2 = &_1; // scope 1 at $DIR/static_ref.rs:+3:17: +3:19
|
||||
StorageLive(_3); // scope 2 at $DIR/static_ref.rs:+4:9: +4:11
|
||||
StorageLive(_4); // scope 2 at $DIR/static_ref.rs:+4:9: +4:11
|
||||
StorageLive(_5); // scope 2 at $DIR/static_ref.rs:+4:10: +4:11
|
||||
_5 = const {alloc1: &i32}; // scope 2 at $DIR/static_ref.rs:+4:10: +4:11
|
||||
StorageLive(_1); // scope 0 at $DIR/static_ref.rs:+3:9: +3:10
|
||||
_1 = const 0_i32; // scope 0 at $DIR/static_ref.rs:+3:13: +3:14
|
||||
StorageLive(_2); // scope 1 at $DIR/static_ref.rs:+4:9: +4:14
|
||||
_2 = &_1; // scope 1 at $DIR/static_ref.rs:+4:17: +4:19
|
||||
StorageLive(_3); // scope 2 at $DIR/static_ref.rs:+5:9: +5:11
|
||||
StorageLive(_4); // scope 2 at $DIR/static_ref.rs:+5:9: +5:11
|
||||
StorageLive(_5); // scope 2 at $DIR/static_ref.rs:+5:10: +5:11
|
||||
_5 = const {alloc1: &i32}; // scope 2 at $DIR/static_ref.rs:+5:10: +5:11
|
||||
// mir::Constant
|
||||
// + span: $DIR/static_ref.rs:8:10: 8:11
|
||||
// + span: $DIR/static_ref.rs:10:10: 10:11
|
||||
// + literal: Const { ty: &i32, val: Value(Scalar(alloc1)) }
|
||||
_4 = &(*_5); // scope 2 at $DIR/static_ref.rs:+4:9: +4:11
|
||||
_3 = &(*_4); // scope 2 at $DIR/static_ref.rs:+4:9: +4:11
|
||||
_2 = move _3; // scope 2 at $DIR/static_ref.rs:+4:5: +4:11
|
||||
StorageDead(_3); // scope 2 at $DIR/static_ref.rs:+4:10: +4:11
|
||||
StorageDead(_5); // scope 2 at $DIR/static_ref.rs:+4:11: +4:12
|
||||
StorageDead(_4); // scope 2 at $DIR/static_ref.rs:+4:11: +4:12
|
||||
StorageLive(_6); // scope 2 at $DIR/static_ref.rs:+5:9: +5:10
|
||||
_6 = (*_2); // scope 2 at $DIR/static_ref.rs:+5:13: +5:15
|
||||
_0 = const (); // scope 0 at $DIR/static_ref.rs:+0:11: +6:2
|
||||
StorageDead(_6); // scope 2 at $DIR/static_ref.rs:+6:1: +6:2
|
||||
StorageDead(_2); // scope 1 at $DIR/static_ref.rs:+6:1: +6:2
|
||||
StorageDead(_1); // scope 0 at $DIR/static_ref.rs:+6:1: +6:2
|
||||
return; // scope 0 at $DIR/static_ref.rs:+6:2: +6:2
|
||||
_4 = &(*_5); // scope 2 at $DIR/static_ref.rs:+5:9: +5:11
|
||||
_3 = &(*_4); // scope 2 at $DIR/static_ref.rs:+5:9: +5:11
|
||||
_2 = move _3; // scope 2 at $DIR/static_ref.rs:+5:5: +5:11
|
||||
StorageDead(_3); // scope 2 at $DIR/static_ref.rs:+5:10: +5:11
|
||||
StorageDead(_5); // scope 2 at $DIR/static_ref.rs:+5:11: +5:12
|
||||
StorageDead(_4); // scope 2 at $DIR/static_ref.rs:+5:11: +5:12
|
||||
StorageLive(_6); // scope 2 at $DIR/static_ref.rs:+6:9: +6:10
|
||||
_6 = (*_2); // scope 2 at $DIR/static_ref.rs:+6:13: +6:15
|
||||
_0 = const (); // scope 0 at $DIR/static_ref.rs:+0:11: +7:2
|
||||
StorageDead(_6); // scope 2 at $DIR/static_ref.rs:+7:1: +7:2
|
||||
StorageDead(_2); // scope 1 at $DIR/static_ref.rs:+7:1: +7:2
|
||||
StorageDead(_1); // scope 0 at $DIR/static_ref.rs:+7:1: +7:2
|
||||
return; // scope 0 at $DIR/static_ref.rs:+7:2: +7:2
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
// unit-test: DataflowConstProp
|
||||
// compile-flags: -Zunsound-mir-opts
|
||||
|
||||
// EMIT_MIR static_ref.main.DataflowConstProp.diff
|
||||
fn main() {
|
||||
// Currently, this will not propagate.
|
||||
static P: i32 = 5;
|
||||
let x = 0;
|
||||
let mut r = &x;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user