diff --git a/src/test/mir-opt/dataflow-const-prop/previous/bad_op_mod_by_zero.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/previous/bad_op_mod_by_zero.main.DataflowConstProp.diff index 59bd12670155..cc8dea75c9cb 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/bad_op_mod_by_zero.main.DataflowConstProp.diff +++ b/src/test/mir-opt/dataflow-const-prop/previous/bad_op_mod_by_zero.main.DataflowConstProp.diff @@ -22,22 +22,30 @@ _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 = 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 +- _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 = 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 +- _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, const 0_i32); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 +- _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 - nop; // scope 0 at $DIR/bad_op_mod_by_zero.rs:+0:11: +3:2 + _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 diff --git a/src/test/mir-opt/dataflow-const-prop/previous/bad_op_mod_by_zero.rs b/src/test/mir-opt/dataflow-const-prop/previous/bad_op_mod_by_zero.rs index 6a7a82e5034b..ad30a5b6242e 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/bad_op_mod_by_zero.rs +++ b/src/test/mir-opt/dataflow-const-prop/previous/bad_op_mod_by_zero.rs @@ -1,3 +1,4 @@ +// unit-test: DataflowConstProp // EMIT_MIR bad_op_mod_by_zero.main.DataflowConstProp.diff #[allow(unconditional_panic)] fn main() { diff --git a/src/test/mir-opt/dataflow-const-prop/previous/bad_op_unsafe_oob_for_slices.main.DataflowConstProp.32bit.diff b/src/test/mir-opt/dataflow-const-prop/previous/bad_op_unsafe_oob_for_slices.main.DataflowConstProp.32bit.diff index 65cd79463676..86ed32a1f9dc 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/bad_op_unsafe_oob_for_slices.main.DataflowConstProp.32bit.diff +++ b/src/test/mir-opt/dataflow-const-prop/previous/bad_op_unsafe_oob_for_slices.main.DataflowConstProp.32bit.diff @@ -27,9 +27,9 @@ StorageLive(_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 _9 = const main::promoted[0]; // 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:5:25: 5:35 + // + 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 + _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 @@ -38,14 +38,16 @@ 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(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 +- _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 - nop; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+2:5: +4:6 + _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 diff --git a/src/test/mir-opt/dataflow-const-prop/previous/bad_op_unsafe_oob_for_slices.main.DataflowConstProp.64bit.diff b/src/test/mir-opt/dataflow-const-prop/previous/bad_op_unsafe_oob_for_slices.main.DataflowConstProp.64bit.diff index 65cd79463676..86ed32a1f9dc 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/bad_op_unsafe_oob_for_slices.main.DataflowConstProp.64bit.diff +++ b/src/test/mir-opt/dataflow-const-prop/previous/bad_op_unsafe_oob_for_slices.main.DataflowConstProp.64bit.diff @@ -27,9 +27,9 @@ StorageLive(_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 _9 = const main::promoted[0]; // 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:5:25: 5:35 + // + 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 + _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 @@ -38,14 +38,16 @@ 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(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 +- _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 - nop; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+2:5: +4:6 + _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 diff --git a/src/test/mir-opt/dataflow-const-prop/previous/bad_op_unsafe_oob_for_slices.rs b/src/test/mir-opt/dataflow-const-prop/previous/bad_op_unsafe_oob_for_slices.rs index e4cc9cb917ed..c97257e6d8fa 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/bad_op_unsafe_oob_for_slices.rs +++ b/src/test/mir-opt/dataflow-const-prop/previous/bad_op_unsafe_oob_for_slices.rs @@ -1,3 +1,4 @@ +// unit-test: DataflowConstProp // EMIT_MIR_FOR_EACH_BIT_WIDTH // EMIT_MIR bad_op_unsafe_oob_for_slices.main.DataflowConstProp.diff #[allow(unconditional_panic)] diff --git a/src/test/mir-opt/dataflow-const-prop/previous/mult_by_zero.rs b/src/test/mir-opt/dataflow-const-prop/previous/mult_by_zero.rs index e169135e0acd..a6f156fe052e 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/mult_by_zero.rs +++ b/src/test/mir-opt/dataflow-const-prop/previous/mult_by_zero.rs @@ -1,5 +1,4 @@ -// unit-test -// compile-flags: -O -Zmir-opt-level=4 +// unit-test: DataflowConstProp // EMIT_MIR mult_by_zero.test.DataflowConstProp.diff fn test(x: i32) -> i32 { diff --git a/src/test/mir-opt/dataflow-const-prop/previous/mult_by_zero.test.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/previous/mult_by_zero.test.DataflowConstProp.diff index 540cccb3b375..c225b35e1923 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/mult_by_zero.test.DataflowConstProp.diff +++ b/src/test/mir-opt/dataflow-const-prop/previous/mult_by_zero.test.DataflowConstProp.diff @@ -9,7 +9,7 @@ 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 = const 0_i32; // scope 0 at $DIR/mult_by_zero.rs:+1:5: +1:10 + _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 } diff --git a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable.main.DataflowConstProp.diff index 03556e85088e..098440dbe2f1 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable.main.DataflowConstProp.diff +++ b/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable.main.DataflowConstProp.diff @@ -17,8 +17,9 @@ _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 = const 99_i32; // scope 1 at $DIR/mutable_variable.rs:+3:13: +3:14 - nop; // scope 0 at $DIR/mutable_variable.rs:+0:11: +4:2 +- _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 diff --git a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable.rs b/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable.rs index 055b7f158da0..680bcd7fc703 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable.rs +++ b/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable.rs @@ -1,5 +1,4 @@ -// unit-test -// compile-flags: -O +// unit-test: DataflowConstProp // EMIT_MIR mutable_variable.main.DataflowConstProp.diff fn main() { diff --git a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate.main.DataflowConstProp.diff index 7b5be873ee82..1180dffdbadb 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate.main.DataflowConstProp.diff +++ b/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate.main.DataflowConstProp.diff @@ -19,8 +19,8 @@ (_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 = const (42_i32, 99_i32); // scope 1 at $DIR/mutable_variable_aggregate.rs:+3:13: +3:14 - nop; // scope 0 at $DIR/mutable_variable_aggregate.rs:+0:11: +4:2 + _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 diff --git a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate.rs b/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate.rs index 854c2d3b8a80..255236049f98 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate.rs +++ b/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate.rs @@ -1,5 +1,4 @@ -// unit-test -// compile-flags: -O +// unit-test: DataflowConstProp // EMIT_MIR mutable_variable_aggregate.main.DataflowConstProp.diff fn main() { diff --git a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate_mut_ref.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate_mut_ref.main.DataflowConstProp.diff index 8c3f4b926180..f27885478007 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate_mut_ref.main.DataflowConstProp.diff +++ b/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate_mut_ref.main.DataflowConstProp.diff @@ -26,7 +26,7 @@ ((*_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 - nop; // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+0:11: +5:2 + _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 diff --git a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate_mut_ref.rs b/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate_mut_ref.rs index 18df3596cff1..54b898b4ee5c 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate_mut_ref.rs +++ b/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate_mut_ref.rs @@ -1,5 +1,4 @@ -// unit-test -// compile-flags: -O +// unit-test: DataflowConstProp // EMIT_MIR mutable_variable_aggregate_mut_ref.main.DataflowConstProp.diff fn main() { diff --git a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate_partial_read.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate_partial_read.main.DataflowConstProp.diff index fb396e7a121a..1f8e283f33a5 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate_partial_read.main.DataflowConstProp.diff +++ b/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate_partial_read.main.DataflowConstProp.diff @@ -16,7 +16,7 @@ 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:6:29: 6:32 + // + span: $DIR/mutable_variable_aggregate_partial_read.rs:5:29: 5:32 // + literal: Const { ty: fn() -> (i32, i32) {foo}, val: Value() } } @@ -24,8 +24,9 @@ (_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 = const 99_i32; // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:13: +4:16 - nop; // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+0:11: +5:2 +- _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 diff --git a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate_partial_read.rs b/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate_partial_read.rs index 39a77ba17894..0439a5208199 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate_partial_read.rs +++ b/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate_partial_read.rs @@ -1,5 +1,4 @@ -// unit-test -// compile-flags: -O +// unit-test: DataflowConstProp // EMIT_MIR mutable_variable_aggregate_partial_read.main.DataflowConstProp.diff fn main() { diff --git a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_no_prop.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_no_prop.main.DataflowConstProp.diff index 783aaacca3c0..9363e6b9aa1c 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_no_prop.main.DataflowConstProp.diff +++ b/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_no_prop.main.DataflowConstProp.diff @@ -25,17 +25,17 @@ 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:10:13: 10:19 + // + 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 - nop; // scope 2 at $DIR/mutable_variable_no_prop.rs:+2:5: +4:6 + _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 - nop; // scope 0 at $DIR/mutable_variable_no_prop.rs:+0:11: +6:2 + _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 diff --git a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_no_prop.rs b/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_no_prop.rs index 26f9cab5cd44..e4edf1475f2b 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_no_prop.rs +++ b/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_no_prop.rs @@ -1,5 +1,4 @@ -// unit-test -// compile-flags: -O +// unit-test: DataflowConstProp static mut STATIC: u32 = 42; diff --git a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_unprop_assign.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_unprop_assign.main.DataflowConstProp.diff index 2f6aeca20763..8d31d5533da2 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_unprop_assign.main.DataflowConstProp.diff +++ b/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_unprop_assign.main.DataflowConstProp.diff @@ -25,7 +25,7 @@ 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:6:13: 6:16 + // + span: $DIR/mutable_variable_unprop_assign.rs:5:13: 5:16 // + literal: Const { ty: fn() -> i32 {foo}, val: Value() } } @@ -41,8 +41,9 @@ 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 = const 1_i32; // scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:13: +5:16 - nop; // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+0:11: +6:2 +- _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 diff --git a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_unprop_assign.rs b/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_unprop_assign.rs index 92da91682d16..942e96fee444 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_unprop_assign.rs +++ b/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_unprop_assign.rs @@ -1,5 +1,4 @@ -// unit-test -// compile-flags: -O +// unit-test: DataflowConstProp // EMIT_MIR mutable_variable_unprop_assign.main.DataflowConstProp.diff fn main() { diff --git a/src/test/mir-opt/dataflow-const-prop/previous/read_immutable_static.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/previous/read_immutable_static.main.DataflowConstProp.diff index dd3dc9b9e4db..a48ba5bf2e1b 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/read_immutable_static.main.DataflowConstProp.diff +++ b/src/test/mir-opt/dataflow-const-prop/previous/read_immutable_static.main.DataflowConstProp.diff @@ -18,22 +18,22 @@ 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:8:13: 8:16 + // + span: $DIR/read_immutable_static.rs:7:13: 7:16 // + literal: Const { ty: &u8, val: Value(Scalar(alloc1)) } - _2 = const 2_u8; // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:16 + _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:8:19: 8:22 + // + span: $DIR/read_immutable_static.rs:7:19: 7:22 // + literal: Const { ty: &u8, val: Value(Scalar(alloc1)) } - _4 = const 2_u8; // scope 0 at $DIR/read_immutable_static.rs:+1:19: +1:22 - _1 = const 4_u8; // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:22 + _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 - nop; // scope 0 at $DIR/read_immutable_static.rs:+0:11: +2:2 + _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 } diff --git a/src/test/mir-opt/dataflow-const-prop/previous/read_immutable_static.rs b/src/test/mir-opt/dataflow-const-prop/previous/read_immutable_static.rs index 0ca5668fb862..6324b4a9c545 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/read_immutable_static.rs +++ b/src/test/mir-opt/dataflow-const-prop/previous/read_immutable_static.rs @@ -1,5 +1,4 @@ -// unit-test -// compile-flags: -O +// unit-test: DataflowConstProp static FOO: u8 = 2; diff --git a/src/test/mir-opt/dataflow-const-prop/previous/ref_deref.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/previous/ref_deref.main.DataflowConstProp.diff index 74c53808e159..045836b6373d 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/ref_deref.main.DataflowConstProp.diff +++ b/src/test/mir-opt/dataflow-const-prop/previous/ref_deref.main.DataflowConstProp.diff @@ -13,13 +13,13 @@ StorageLive(_2); // scope 0 at $DIR/ref_deref.rs:+1:6: +1:10 _4 = const main::promoted[0]; // scope 0 at $DIR/ref_deref.rs:+1:6: +1:10 // mir::Constant - // + span: $DIR/ref_deref.rs:5:6: 5:10 + // + 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 = const 4_i32; // scope 0 at $DIR/ref_deref.rs:+1:5: +1:10 + _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 - nop; // scope 0 at $DIR/ref_deref.rs:+0:11: +2:2 + _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 } } diff --git a/src/test/mir-opt/dataflow-const-prop/previous/ref_deref.main.PromoteTemps.diff b/src/test/mir-opt/dataflow-const-prop/previous/ref_deref.main.PromoteTemps.diff index d141d2cf87bb..37eb403fd411 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/ref_deref.main.PromoteTemps.diff +++ b/src/test/mir-opt/dataflow-const-prop/previous/ref_deref.main.PromoteTemps.diff @@ -16,7 +16,7 @@ - _2 = &_3; // scope 0 at $DIR/ref_deref.rs:+1:6: +1:10 + _4 = const main::promoted[0]; // scope 0 at $DIR/ref_deref.rs:+1:6: +1:10 + // mir::Constant -+ // + span: $DIR/ref_deref.rs:5:6: 5:10 ++ // + 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 diff --git a/src/test/mir-opt/dataflow-const-prop/previous/ref_deref.rs b/src/test/mir-opt/dataflow-const-prop/previous/ref_deref.rs index ee9426dd906e..b3ec2383b913 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/ref_deref.rs +++ b/src/test/mir-opt/dataflow-const-prop/previous/ref_deref.rs @@ -1,3 +1,4 @@ +// unit-test: DataflowConstProp // EMIT_MIR ref_deref.main.PromoteTemps.diff // EMIT_MIR ref_deref.main.DataflowConstProp.diff diff --git a/src/test/mir-opt/dataflow-const-prop/previous/ref_deref_project.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/previous/ref_deref_project.main.DataflowConstProp.diff index 66828e5013c9..1a3761f15aa9 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/ref_deref_project.main.DataflowConstProp.diff +++ b/src/test/mir-opt/dataflow-const-prop/previous/ref_deref_project.main.DataflowConstProp.diff @@ -19,7 +19,7 @@ _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 - nop; // scope 0 at $DIR/ref_deref_project.rs:+0:11: +2:2 + _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 } } diff --git a/src/test/mir-opt/dataflow-const-prop/previous/ref_deref_project.rs b/src/test/mir-opt/dataflow-const-prop/previous/ref_deref_project.rs index b28fb320d33e..65175917e13b 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/ref_deref_project.rs +++ b/src/test/mir-opt/dataflow-const-prop/previous/ref_deref_project.rs @@ -1,4 +1,4 @@ -// unit-test +// unit-test: DataflowConstProp // EMIT_MIR ref_deref_project.main.PromoteTemps.diff // EMIT_MIR ref_deref_project.main.DataflowConstProp.diff diff --git a/src/test/mir-opt/dataflow-const-prop/previous/reify_fn_ptr.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/previous/reify_fn_ptr.main.DataflowConstProp.diff index 7581b852a89b..6822f353b05b 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/reify_fn_ptr.main.DataflowConstProp.diff +++ b/src/test/mir-opt/dataflow-const-prop/previous/reify_fn_ptr.main.DataflowConstProp.diff @@ -15,14 +15,14 @@ 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:4:13: 4:17 + // + span: $DIR/reify_fn_ptr.rs:5:13: 5:17 // + literal: Const { ty: fn() {main}, val: Value() } _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 - nop; // scope 0 at $DIR/reify_fn_ptr.rs:+0:11: +2:2 + _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 } } diff --git a/src/test/mir-opt/dataflow-const-prop/previous/reify_fn_ptr.rs b/src/test/mir-opt/dataflow-const-prop/previous/reify_fn_ptr.rs index 00205a296308..c69680d36e2b 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/reify_fn_ptr.rs +++ b/src/test/mir-opt/dataflow-const-prop/previous/reify_fn_ptr.rs @@ -1,3 +1,4 @@ +// unit-test: DataflowConstProp // EMIT_MIR reify_fn_ptr.main.DataflowConstProp.diff fn main() { diff --git a/src/test/mir-opt/dataflow-const-prop/previous/repeat.main.DataflowConstProp.32bit.diff b/src/test/mir-opt/dataflow-const-prop/previous/repeat.main.DataflowConstProp.32bit.diff index f7e60a5a351d..4e3de9df468e 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/repeat.main.DataflowConstProp.32bit.diff +++ b/src/test/mir-opt/dataflow-const-prop/previous/repeat.main.DataflowConstProp.32bit.diff @@ -20,18 +20,20 @@ _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 = const 8_usize; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 - _6 = const true; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 - assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> bb1; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 + _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 = const 42_u32; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 - _1 = const 42_u32; // scope 0 at $DIR/repeat.rs:+1:18: +1:32 + _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 - nop; // scope 0 at $DIR/repeat.rs:+0:11: +2:2 + _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 } diff --git a/src/test/mir-opt/dataflow-const-prop/previous/repeat.main.DataflowConstProp.64bit.diff b/src/test/mir-opt/dataflow-const-prop/previous/repeat.main.DataflowConstProp.64bit.diff index f7e60a5a351d..4e3de9df468e 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/repeat.main.DataflowConstProp.64bit.diff +++ b/src/test/mir-opt/dataflow-const-prop/previous/repeat.main.DataflowConstProp.64bit.diff @@ -20,18 +20,20 @@ _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 = const 8_usize; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 - _6 = const true; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 - assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> bb1; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 + _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 = const 42_u32; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 - _1 = const 42_u32; // scope 0 at $DIR/repeat.rs:+1:18: +1:32 + _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 - nop; // scope 0 at $DIR/repeat.rs:+0:11: +2:2 + _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 } diff --git a/src/test/mir-opt/dataflow-const-prop/previous/repeat.rs b/src/test/mir-opt/dataflow-const-prop/previous/repeat.rs index ade87676869e..df5284d11dad 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/repeat.rs +++ b/src/test/mir-opt/dataflow-const-prop/previous/repeat.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +// unit-test: DataflowConstProp // EMIT_MIR_FOR_EACH_BIT_WIDTH // EMIT_MIR repeat.main.DataflowConstProp.diff diff --git a/src/test/mir-opt/dataflow-const-prop/previous/return_place.add.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/previous/return_place.add.DataflowConstProp.diff index f7a3227f39de..07cdba28e042 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/return_place.add.DataflowConstProp.diff +++ b/src/test/mir-opt/dataflow-const-prop/previous/return_place.add.DataflowConstProp.diff @@ -6,12 +6,14 @@ let mut _1: (u32, bool); // in scope 0 at $DIR/return_place.rs:+1:5: +1:10 bb0: { - _1 = const (4_u32, false); // 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 + _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 = const 4_u32; // scope 0 at $DIR/return_place.rs:+1:5: +1:10 +- _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 } } diff --git a/src/test/mir-opt/dataflow-const-prop/previous/return_place.add.PreCodegen.before.mir b/src/test/mir-opt/dataflow-const-prop/previous/return_place.add.PreCodegen.before.mir index ececd9942838..4f5ea6320f16 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/return_place.add.PreCodegen.before.mir +++ b/src/test/mir-opt/dataflow-const-prop/previous/return_place.add.PreCodegen.before.mir @@ -2,8 +2,14 @@ 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 } diff --git a/src/test/mir-opt/dataflow-const-prop/previous/return_place.rs b/src/test/mir-opt/dataflow-const-prop/previous/return_place.rs index d4cac2c76ddc..26365cc5db2d 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/return_place.rs +++ b/src/test/mir-opt/dataflow-const-prop/previous/return_place.rs @@ -1,3 +1,4 @@ +// unit-test: DataflowConstProp // compile-flags: -C overflow-checks=on // EMIT_MIR return_place.add.DataflowConstProp.diff diff --git a/src/test/mir-opt/dataflow-const-prop/previous/scalar_literal_propagation.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/previous/scalar_literal_propagation.main.DataflowConstProp.diff index 97609293c9a5..a0212aea5dd8 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/scalar_literal_propagation.main.DataflowConstProp.diff +++ b/src/test/mir-opt/dataflow-const-prop/previous/scalar_literal_propagation.main.DataflowConstProp.diff @@ -15,17 +15,19 @@ _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 = 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 +- _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:4:5: 4:12 + // + span: $DIR/scalar_literal_propagation.rs:5:5: 5:12 // + literal: Const { ty: fn(u32) {consume}, val: Value() } } 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 - nop; // scope 0 at $DIR/scalar_literal_propagation.rs:+0:11: +3:2 + _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 } diff --git a/src/test/mir-opt/dataflow-const-prop/previous/scalar_literal_propagation.rs b/src/test/mir-opt/dataflow-const-prop/previous/scalar_literal_propagation.rs index 00726b6f13de..d26cb30c0764 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/scalar_literal_propagation.rs +++ b/src/test/mir-opt/dataflow-const-prop/previous/scalar_literal_propagation.rs @@ -1,3 +1,4 @@ +// unit-test: DataflowConstProp // EMIT_MIR scalar_literal_propagation.main.DataflowConstProp.diff fn main() { let x = 1; diff --git a/src/test/mir-opt/dataflow-const-prop/previous/slice_len.main.DataflowConstProp.32bit.diff b/src/test/mir-opt/dataflow-const-prop/previous/slice_len.main.DataflowConstProp.32bit.diff index 7af3a3881df2..39955097a28c 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/slice_len.main.DataflowConstProp.32bit.diff +++ b/src/test/mir-opt/dataflow-const-prop/previous/slice_len.main.DataflowConstProp.32bit.diff @@ -12,7 +12,6 @@ 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 - let mut _10: &[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 @@ -21,29 +20,28 @@ StorageLive(_4); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 _9 = const main::promoted[0]; // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 // mir::Constant - // + span: $DIR/slice_len.rs:5:6: 5:19 + // + 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 - StorageLive(_10); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 - _10 = _3; // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 + _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 = const 3_usize; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 - StorageDead(_10); // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 - _8 = const true; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 - assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> bb1; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 + _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 = const 2_u32; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 + _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 - nop; // scope 0 at $DIR/slice_len.rs:+0:11: +2:2 + _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 } } diff --git a/src/test/mir-opt/dataflow-const-prop/previous/slice_len.main.DataflowConstProp.64bit.diff b/src/test/mir-opt/dataflow-const-prop/previous/slice_len.main.DataflowConstProp.64bit.diff index 7af3a3881df2..39955097a28c 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/slice_len.main.DataflowConstProp.64bit.diff +++ b/src/test/mir-opt/dataflow-const-prop/previous/slice_len.main.DataflowConstProp.64bit.diff @@ -12,7 +12,6 @@ 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 - let mut _10: &[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 @@ -21,29 +20,28 @@ StorageLive(_4); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 _9 = const main::promoted[0]; // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 // mir::Constant - // + span: $DIR/slice_len.rs:5:6: 5:19 + // + 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 - StorageLive(_10); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 - _10 = _3; // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 + _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 = const 3_usize; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 - StorageDead(_10); // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 - _8 = const true; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 - assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> bb1; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 + _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 = const 2_u32; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 + _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 - nop; // scope 0 at $DIR/slice_len.rs:+0:11: +2:2 + _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 } } diff --git a/src/test/mir-opt/dataflow-const-prop/previous/slice_len.rs b/src/test/mir-opt/dataflow-const-prop/previous/slice_len.rs index 224ccb70f8b4..b22d33795ef1 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/slice_len.rs +++ b/src/test/mir-opt/dataflow-const-prop/previous/slice_len.rs @@ -1,3 +1,4 @@ +// unit-test: DataflowConstProp // EMIT_MIR_FOR_EACH_BIT_WIDTH // EMIT_MIR slice_len.main.DataflowConstProp.diff diff --git a/src/test/mir-opt/dataflow-const-prop/previous/tuple_literal_propagation.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/previous/tuple_literal_propagation.main.DataflowConstProp.diff index 7fcde2be1714..3a1b5f374f0f 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/tuple_literal_propagation.main.DataflowConstProp.diff +++ b/src/test/mir-opt/dataflow-const-prop/previous/tuple_literal_propagation.main.DataflowConstProp.diff @@ -17,17 +17,17 @@ (_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 = const (1_u32, 2_u32); // 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:5:5: 5:12 + // + span: $DIR/tuple_literal_propagation.rs:6:5: 6:12 // + literal: Const { ty: fn((u32, u32)) {consume}, val: Value() } } 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 - nop; // scope 0 at $DIR/tuple_literal_propagation.rs:+0:11: +4:2 + _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 } diff --git a/src/test/mir-opt/dataflow-const-prop/previous/tuple_literal_propagation.rs b/src/test/mir-opt/dataflow-const-prop/previous/tuple_literal_propagation.rs index 41085838127f..737f39673a3c 100644 --- a/src/test/mir-opt/dataflow-const-prop/previous/tuple_literal_propagation.rs +++ b/src/test/mir-opt/dataflow-const-prop/previous/tuple_literal_propagation.rs @@ -1,3 +1,4 @@ +// unit-test: DataflowConstProp // EMIT_MIR tuple_literal_propagation.main.DataflowConstProp.diff fn main() { let x = (1, 2);