diff options
Diffstat (limited to '')
-rw-r--r-- | tests/mir-opt/const_prop/aggregate.main.ConstProp.diff (renamed from src/test/mir-opt/const_prop/aggregate.main.ConstProp.diff) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/aggregate.main.PreCodegen.after.mir (renamed from src/test/mir-opt/const_prop/aggregate.main.PreCodegen.after.mir) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/aggregate.rs (renamed from src/test/mir-opt/const_prop/aggregate.rs) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.diff (renamed from src/test/mir-opt/const_prop/array_index.main.ConstProp.32bit.diff) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.diff (renamed from src/test/mir-opt/const_prop/array_index.main.ConstProp.64bit.diff) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/array_index.rs (renamed from src/test/mir-opt/const_prop/array_index.rs) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.diff (renamed from src/test/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.diff) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/bad_op_div_by_zero.rs (renamed from src/test/mir-opt/const_prop/bad_op_div_by_zero.rs) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.diff (renamed from src/test/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.diff) | 1 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/bad_op_mod_by_zero.rs (renamed from src/test/mir-opt/const_prop/bad_op_mod_by_zero.rs) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff | 54 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff | 54 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs (renamed from src/test/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/boolean_identities.rs (renamed from src/test/mir-opt/const_prop/boolean_identities.rs) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/boolean_identities.test.ConstProp.diff (renamed from src/test/mir-opt/const_prop/boolean_identities.test.ConstProp.diff) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/boxes.main.ConstProp.diff (renamed from src/test/mir-opt/const_prop/boxes.main.ConstProp.diff) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/boxes.rs (renamed from src/test/mir-opt/const_prop/boxes.rs) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/cast.main.ConstProp.diff (renamed from src/test/mir-opt/const_prop/cast.main.ConstProp.diff) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/cast.rs (renamed from src/test/mir-opt/const_prop/cast.rs) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/checked_add.main.ConstProp.diff (renamed from src/test/mir-opt/const_prop/checked_add.main.ConstProp.diff) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/checked_add.rs (renamed from src/test/mir-opt/const_prop/checked_add.rs) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.diff (renamed from src/test/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.diff) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/const_prop_fails_gracefully.rs (renamed from src/test/mir-opt/const_prop/const_prop_fails_gracefully.rs) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff (renamed from src/test/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff) | 5 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.mir (renamed from src/test/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.mir) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/control_flow_simplification.rs (renamed from src/test/mir-opt/const_prop/control_flow_simplification.rs) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff (renamed from src/test/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff) | 6 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff (renamed from src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff) | 6 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/discriminant.rs (renamed from src/test/mir-opt/const_prop/discriminant.rs) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/indirect.main.ConstProp.diff (renamed from src/test/mir-opt/const_prop/indirect.main.ConstProp.diff) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/indirect.rs (renamed from src/test/mir-opt/const_prop/indirect.rs) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/invalid_constant.main.ConstProp.diff (renamed from src/test/mir-opt/const_prop/invalid_constant.main.ConstProp.diff) | 19 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/invalid_constant.rs (renamed from src/test/mir-opt/const_prop/invalid_constant.rs) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/issue_66971.main.ConstProp.diff | 27 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/issue_66971.rs (renamed from src/test/mir-opt/const_prop/issue_66971.rs) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/issue_67019.main.ConstProp.diff (renamed from src/test/mir-opt/const_prop/issue_67019.main.ConstProp.diff) | 1 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/issue_67019.rs (renamed from src/test/mir-opt/const_prop/issue_67019.rs) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.diff (renamed from src/test/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.diff) | 1 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.diff (renamed from src/test/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.diff) | 1 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/large_array_index.rs (renamed from src/test/mir-opt/const_prop/large_array_index.rs) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/mult_by_zero.rs (renamed from src/test/mir-opt/const_prop/mult_by_zero.rs) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/mult_by_zero.test.ConstProp.diff (renamed from src/test/mir-opt/const_prop/mult_by_zero.test.ConstProp.diff) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/mutable_variable.main.ConstProp.diff (renamed from src/test/mir-opt/const_prop/mutable_variable.main.ConstProp.diff) | 1 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/mutable_variable.rs (renamed from src/test/mir-opt/const_prop/mutable_variable.rs) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff (renamed from src/test/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff) | 1 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/mutable_variable_aggregate.rs (renamed from src/test/mir-opt/const_prop/mutable_variable_aggregate.rs) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.ConstProp.diff (renamed from src/test/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.ConstProp.diff) | 1 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs (renamed from src/test/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.diff (renamed from src/test/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.diff) | 1 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs (renamed from src/test/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/mutable_variable_no_prop.main.ConstProp.diff | 43 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/mutable_variable_no_prop.rs (renamed from src/test/mir-opt/const_prop/mutable_variable_no_prop.rs) | 2 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.diff | 57 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs (renamed from src/test/mir-opt/const_prop/mutable_variable_unprop_assign.rs) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.32bit.diff (renamed from src/test/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.32bit.diff) | 19 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.64bit.diff (renamed from src/test/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.64bit.diff) | 19 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/optimizes_into_variable.main.PreCodegen.after.32bit.mir (renamed from src/test/mir-opt/const_prop/optimizes_into_variable.main.PreCodegen.after.32bit.mir) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/optimizes_into_variable.main.PreCodegen.after.64bit.mir (renamed from src/test/mir-opt/const_prop/optimizes_into_variable.main.PreCodegen.after.64bit.mir) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.diff (renamed from src/test/mir-opt/const_prop/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.diff) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.diff (renamed from src/test/mir-opt/const_prop/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.diff) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.mir | 27 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.mir | 27 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/optimizes_into_variable.rs (renamed from src/test/mir-opt/const_prop/optimizes_into_variable.rs) | 2 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/read_immutable_static.main.ConstProp.diff (renamed from src/test/mir-opt/const_prop/read_immutable_static.main.ConstProp.diff) | 1 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/read_immutable_static.rs (renamed from src/test/mir-opt/const_prop/read_immutable_static.rs) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/ref_deref.main.ConstProp.diff (renamed from src/test/mir-opt/const_prop/ref_deref.main.ConstProp.diff) | 2 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/ref_deref.main.PromoteTemps.diff (renamed from src/test/mir-opt/const_prop/ref_deref.main.PromoteTemps.diff) | 2 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/ref_deref.rs | 7 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/ref_deref_project.main.ConstProp.diff (renamed from src/test/mir-opt/const_prop/ref_deref_project.main.ConstProp.diff) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/ref_deref_project.main.PromoteTemps.diff (renamed from src/test/mir-opt/const_prop/ref_deref_project.main.PromoteTemps.diff) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/ref_deref_project.rs | 7 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/reify_fn_ptr.main.ConstProp.diff | 24 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/reify_fn_ptr.rs (renamed from src/test/mir-opt/const_prop/reify_fn_ptr.rs) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.diff (renamed from src/test/mir-opt/const_prop/repeat.main.ConstProp.32bit.diff) | 1 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.diff (renamed from src/test/mir-opt/const_prop/repeat.main.ConstProp.64bit.diff) | 1 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/repeat.rs (renamed from src/test/mir-opt/const_prop/repeat.rs) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/return_place.add.ConstProp.diff (renamed from src/test/mir-opt/const_prop/return_place.add.ConstProp.diff) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/return_place.add.PreCodegen.before.mir (renamed from src/test/mir-opt/const_prop/return_place.add.PreCodegen.before.mir) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/return_place.rs (renamed from src/test/mir-opt/const_prop/return_place.rs) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.diff (renamed from src/test/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.diff) | 1 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/scalar_literal_propagation.rs (renamed from src/test/mir-opt/const_prop/scalar_literal_propagation.rs) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.diff (renamed from src/test/mir-opt/const_prop/slice_len.main.ConstProp.32bit.diff) | 9 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.diff (renamed from src/test/mir-opt/const_prop/slice_len.main.ConstProp.64bit.diff) | 9 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/slice_len.rs | 7 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/switch_int.main.ConstProp.diff (renamed from src/test/mir-opt/const_prop/switch_int.main.ConstProp.diff) | 4 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.diff (renamed from src/test/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.diff) | 2 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/switch_int.rs (renamed from src/test/mir-opt/const_prop/switch_int.rs) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.diff (renamed from src/test/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.diff) | 1 | ||||
-rw-r--r-- | tests/mir-opt/const_prop/tuple_literal_propagation.rs (renamed from src/test/mir-opt/const_prop/tuple_literal_propagation.rs) | 0 | ||||
-rw-r--r-- | tests/mir-opt/const_prop_miscompile.bar.ConstProp.diff | 37 | ||||
-rw-r--r-- | tests/mir-opt/const_prop_miscompile.foo.ConstProp.diff (renamed from src/test/mir-opt/const_prop_miscompile.foo.ConstProp.diff) | 1 | ||||
-rw-r--r-- | tests/mir-opt/const_prop_miscompile.rs (renamed from src/test/mir-opt/const_prop_miscompile.rs) | 0 |
92 files changed, 408 insertions, 83 deletions
diff --git a/src/test/mir-opt/const_prop/aggregate.main.ConstProp.diff b/tests/mir-opt/const_prop/aggregate.main.ConstProp.diff index 04378dbf3..04378dbf3 100644 --- a/src/test/mir-opt/const_prop/aggregate.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/aggregate.main.ConstProp.diff diff --git a/src/test/mir-opt/const_prop/aggregate.main.PreCodegen.after.mir b/tests/mir-opt/const_prop/aggregate.main.PreCodegen.after.mir index cfc9a72e3..cfc9a72e3 100644 --- a/src/test/mir-opt/const_prop/aggregate.main.PreCodegen.after.mir +++ b/tests/mir-opt/const_prop/aggregate.main.PreCodegen.after.mir diff --git a/src/test/mir-opt/const_prop/aggregate.rs b/tests/mir-opt/const_prop/aggregate.rs index 6a3080384..6a3080384 100644 --- a/src/test/mir-opt/const_prop/aggregate.rs +++ b/tests/mir-opt/const_prop/aggregate.rs diff --git a/src/test/mir-opt/const_prop/array_index.main.ConstProp.32bit.diff b/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.diff index 439b2a3e1..439b2a3e1 100644 --- a/src/test/mir-opt/const_prop/array_index.main.ConstProp.32bit.diff +++ b/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.diff diff --git a/src/test/mir-opt/const_prop/array_index.main.ConstProp.64bit.diff b/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.diff index 439b2a3e1..439b2a3e1 100644 --- a/src/test/mir-opt/const_prop/array_index.main.ConstProp.64bit.diff +++ b/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.diff diff --git a/src/test/mir-opt/const_prop/array_index.rs b/tests/mir-opt/const_prop/array_index.rs index d31c2827b..d31c2827b 100644 --- a/src/test/mir-opt/const_prop/array_index.rs +++ b/tests/mir-opt/const_prop/array_index.rs diff --git a/src/test/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.diff b/tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.diff index bea32a67e..bea32a67e 100644 --- a/src/test/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.diff diff --git a/src/test/mir-opt/const_prop/bad_op_div_by_zero.rs b/tests/mir-opt/const_prop/bad_op_div_by_zero.rs index a6fd325ec..a6fd325ec 100644 --- a/src/test/mir-opt/const_prop/bad_op_div_by_zero.rs +++ b/tests/mir-opt/const_prop/bad_op_div_by_zero.rs diff --git a/src/test/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.diff b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.diff index 221513042..8485703e3 100644 --- a/src/test/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.diff @@ -45,7 +45,6 @@ - _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 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/const_prop/bad_op_mod_by_zero.rs b/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs index cc16a4a5a..cc16a4a5a 100644 --- a/src/test/mir-opt/const_prop/bad_op_mod_by_zero.rs +++ b/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff new file mode 100644 index 000000000..27e41d486 --- /dev/null +++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff @@ -0,0 +1,54 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + 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 _5: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24 + let mut _6: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 + let mut _7: bool; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 + let mut _8: &[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 _4: i32; // in scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15 + scope 3 { + debug _b => _4; // 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 + _8 = 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:5:25: 5:35 + // + literal: Const { ty: &[i32; 3], val: Unevaluated(main, [], Some(promoted[0])) } + _3 = _8; // 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(_4); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15 + StorageLive(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24 + _5 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24 + _6 = Len((*_1)); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 +- _7 = Lt(_5, _6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 +- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 ++ _7 = Lt(const 3_usize, _6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 ++ assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, const 3_usize) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 + } + + bb1: { + _4 = (*_1)[_5]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 + StorageDead(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:25: +3:26 + StorageDead(_4); // 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/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff new file mode 100644 index 000000000..27e41d486 --- /dev/null +++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff @@ -0,0 +1,54 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + 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 _5: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24 + let mut _6: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 + let mut _7: bool; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 + let mut _8: &[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 _4: i32; // in scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15 + scope 3 { + debug _b => _4; // 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 + _8 = 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:5:25: 5:35 + // + literal: Const { ty: &[i32; 3], val: Unevaluated(main, [], Some(promoted[0])) } + _3 = _8; // 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(_4); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15 + StorageLive(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24 + _5 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24 + _6 = Len((*_1)); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 +- _7 = Lt(_5, _6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 +- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 ++ _7 = Lt(const 3_usize, _6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 ++ assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, const 3_usize) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 + } + + bb1: { + _4 = (*_1)[_5]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 + StorageDead(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:25: +3:26 + StorageDead(_4); // 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/const_prop/bad_op_unsafe_oob_for_slices.rs b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs index cf22b06d5..cf22b06d5 100644 --- a/src/test/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs +++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs diff --git a/src/test/mir-opt/const_prop/boolean_identities.rs b/tests/mir-opt/const_prop/boolean_identities.rs index c7b609949..c7b609949 100644 --- a/src/test/mir-opt/const_prop/boolean_identities.rs +++ b/tests/mir-opt/const_prop/boolean_identities.rs diff --git a/src/test/mir-opt/const_prop/boolean_identities.test.ConstProp.diff b/tests/mir-opt/const_prop/boolean_identities.test.ConstProp.diff index 0de800917..0de800917 100644 --- a/src/test/mir-opt/const_prop/boolean_identities.test.ConstProp.diff +++ b/tests/mir-opt/const_prop/boolean_identities.test.ConstProp.diff diff --git a/src/test/mir-opt/const_prop/boxes.main.ConstProp.diff b/tests/mir-opt/const_prop/boxes.main.ConstProp.diff index 5ec421eb2..5ec421eb2 100644 --- a/src/test/mir-opt/const_prop/boxes.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/boxes.main.ConstProp.diff diff --git a/src/test/mir-opt/const_prop/boxes.rs b/tests/mir-opt/const_prop/boxes.rs index d287830db..d287830db 100644 --- a/src/test/mir-opt/const_prop/boxes.rs +++ b/tests/mir-opt/const_prop/boxes.rs diff --git a/src/test/mir-opt/const_prop/cast.main.ConstProp.diff b/tests/mir-opt/const_prop/cast.main.ConstProp.diff index 1d4dfc29f..1d4dfc29f 100644 --- a/src/test/mir-opt/const_prop/cast.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/cast.main.ConstProp.diff diff --git a/src/test/mir-opt/const_prop/cast.rs b/tests/mir-opt/const_prop/cast.rs index 984086eda..984086eda 100644 --- a/src/test/mir-opt/const_prop/cast.rs +++ b/tests/mir-opt/const_prop/cast.rs diff --git a/src/test/mir-opt/const_prop/checked_add.main.ConstProp.diff b/tests/mir-opt/const_prop/checked_add.main.ConstProp.diff index 96d0d2566..96d0d2566 100644 --- a/src/test/mir-opt/const_prop/checked_add.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/checked_add.main.ConstProp.diff diff --git a/src/test/mir-opt/const_prop/checked_add.rs b/tests/mir-opt/const_prop/checked_add.rs index b9860da4c..b9860da4c 100644 --- a/src/test/mir-opt/const_prop/checked_add.rs +++ b/tests/mir-opt/const_prop/checked_add.rs diff --git a/src/test/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.diff b/tests/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.diff index bea7114c7..bea7114c7 100644 --- a/src/test/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.diff diff --git a/src/test/mir-opt/const_prop/const_prop_fails_gracefully.rs b/tests/mir-opt/const_prop/const_prop_fails_gracefully.rs index 0a3dcbd38..0a3dcbd38 100644 --- a/src/test/mir-opt/const_prop/const_prop_fails_gracefully.rs +++ b/tests/mir-opt/const_prop/const_prop_fails_gracefully.rs diff --git a/src/test/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff b/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff index 8b3b9d0a4..f270ab8b6 100644 --- a/src/test/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff +++ b/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff @@ -9,8 +9,8 @@ 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(move _1) -> [false: bb2, otherwise: bb1]; // 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 +- switchInt(move _1) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/control_flow_simplification.rs:+1:8: +1:21 ++ switchInt(const false) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/control_flow_simplification.rs:+1:8: +1:21 } bb1: { @@ -25,7 +25,6 @@ } 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 } diff --git a/src/test/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.mir b/tests/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.mir index 9f7528f0c..9f7528f0c 100644 --- a/src/test/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.mir +++ b/tests/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.mir diff --git a/src/test/mir-opt/const_prop/control_flow_simplification.rs b/tests/mir-opt/const_prop/control_flow_simplification.rs index 7dbe8e734..7dbe8e734 100644 --- a/src/test/mir-opt/const_prop/control_flow_simplification.rs +++ b/tests/mir-opt/const_prop/control_flow_simplification.rs diff --git a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff b/tests/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff index 6b29bb59c..b4dccecc6 100644 --- a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff +++ b/tests/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff @@ -21,13 +21,13 @@ ((_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 +- switchInt(move _4) -> [1: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 + _4 = const 1_isize; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 -+ switchInt(const 1_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 ++ switchInt(const 1_isize) -> [1: 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 + switchInt(((_3 as Some).0: bool)) -> [0: bb3, otherwise: bb2]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 } bb2: { diff --git a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff b/tests/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff index 6b29bb59c..b4dccecc6 100644 --- a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff +++ b/tests/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff @@ -21,13 +21,13 @@ ((_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 +- switchInt(move _4) -> [1: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 + _4 = const 1_isize; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 -+ switchInt(const 1_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 ++ switchInt(const 1_isize) -> [1: 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 + switchInt(((_3 as Some).0: bool)) -> [0: bb3, otherwise: bb2]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 } bb2: { diff --git a/src/test/mir-opt/const_prop/discriminant.rs b/tests/mir-opt/const_prop/discriminant.rs index fdd67ca8a..fdd67ca8a 100644 --- a/src/test/mir-opt/const_prop/discriminant.rs +++ b/tests/mir-opt/const_prop/discriminant.rs diff --git a/src/test/mir-opt/const_prop/indirect.main.ConstProp.diff b/tests/mir-opt/const_prop/indirect.main.ConstProp.diff index f4c0c5c5e..f4c0c5c5e 100644 --- a/src/test/mir-opt/const_prop/indirect.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/indirect.main.ConstProp.diff diff --git a/src/test/mir-opt/const_prop/indirect.rs b/tests/mir-opt/const_prop/indirect.rs index 44916cbfe..44916cbfe 100644 --- a/src/test/mir-opt/const_prop/indirect.rs +++ b/tests/mir-opt/const_prop/indirect.rs diff --git a/src/test/mir-opt/const_prop/invalid_constant.main.ConstProp.diff b/tests/mir-opt/const_prop/invalid_constant.main.ConstProp.diff index 67a4dc3c0..6c4757c1a 100644 --- a/src/test/mir-opt/const_prop/invalid_constant.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/invalid_constant.main.ConstProp.diff @@ -7,8 +7,6 @@ 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 @@ -17,9 +15,9 @@ 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<"���">; // in scope 5 at $DIR/invalid_constant.rs:+24:9: +24:22 + let _7: main::Str<"���">; // 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 + debug _non_utf8_str => _7; // in scope 7 at $DIR/invalid_constant.rs:+24:9: +24:22 } } scope 6 { @@ -57,17 +55,8 @@ 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: +27:2 - StorageDead(_9); // scope 5 at $DIR/invalid_constant.rs:+27:1: +27:2 + StorageLive(_7); // scope 5 at $DIR/invalid_constant.rs:+24:9: +24:22 + StorageDead(_7); // scope 5 at $DIR/invalid_constant.rs:+27:1: +27:2 StorageDead(_6); // scope 3 at $DIR/invalid_constant.rs:+27:1: +27:2 StorageDead(_3); // scope 1 at $DIR/invalid_constant.rs:+27:1: +27:2 StorageDead(_1); // scope 0 at $DIR/invalid_constant.rs:+27:1: +27:2 diff --git a/src/test/mir-opt/const_prop/invalid_constant.rs b/tests/mir-opt/const_prop/invalid_constant.rs index 0337a7ca8..0337a7ca8 100644 --- a/src/test/mir-opt/const_prop/invalid_constant.rs +++ b/tests/mir-opt/const_prop/invalid_constant.rs diff --git a/tests/mir-opt/const_prop/issue_66971.main.ConstProp.diff b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.diff new file mode 100644 index 000000000..488e772d0 --- /dev/null +++ b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.diff @@ -0,0 +1,27 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + 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 + + 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 + Deinit(_2); // 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 + _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 + return; // scope 0 at $DIR/issue_66971.rs:+2:2: +2:2 + } + } + diff --git a/src/test/mir-opt/const_prop/issue_66971.rs b/tests/mir-opt/const_prop/issue_66971.rs index 6ca03438e..6ca03438e 100644 --- a/src/test/mir-opt/const_prop/issue_66971.rs +++ b/tests/mir-opt/const_prop/issue_66971.rs diff --git a/src/test/mir-opt/const_prop/issue_67019.main.ConstProp.diff b/tests/mir-opt/const_prop/issue_67019.main.ConstProp.diff index 79cd8bf48..cd5304859 100644 --- a/src/test/mir-opt/const_prop/issue_67019.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/issue_67019.main.ConstProp.diff @@ -27,7 +27,6 @@ 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 } } diff --git a/src/test/mir-opt/const_prop/issue_67019.rs b/tests/mir-opt/const_prop/issue_67019.rs index ffc6fa1f2..ffc6fa1f2 100644 --- a/src/test/mir-opt/const_prop/issue_67019.rs +++ b/tests/mir-opt/const_prop/issue_67019.rs diff --git a/src/test/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.diff b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.diff index 96de39258..5331e5b82 100644 --- a/src/test/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.diff +++ b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.diff @@ -29,7 +29,6 @@ _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 } diff --git a/src/test/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.diff b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.diff index 96de39258..5331e5b82 100644 --- a/src/test/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.diff +++ b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.diff @@ -29,7 +29,6 @@ _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 } diff --git a/src/test/mir-opt/const_prop/large_array_index.rs b/tests/mir-opt/const_prop/large_array_index.rs index 48d134376..48d134376 100644 --- a/src/test/mir-opt/const_prop/large_array_index.rs +++ b/tests/mir-opt/const_prop/large_array_index.rs diff --git a/src/test/mir-opt/const_prop/mult_by_zero.rs b/tests/mir-opt/const_prop/mult_by_zero.rs index c839f92f2..c839f92f2 100644 --- a/src/test/mir-opt/const_prop/mult_by_zero.rs +++ b/tests/mir-opt/const_prop/mult_by_zero.rs diff --git a/src/test/mir-opt/const_prop/mult_by_zero.test.ConstProp.diff b/tests/mir-opt/const_prop/mult_by_zero.test.ConstProp.diff index 629c8e601..629c8e601 100644 --- a/src/test/mir-opt/const_prop/mult_by_zero.test.ConstProp.diff +++ b/tests/mir-opt/const_prop/mult_by_zero.test.ConstProp.diff diff --git a/src/test/mir-opt/const_prop/mutable_variable.main.ConstProp.diff b/tests/mir-opt/const_prop/mutable_variable.main.ConstProp.diff index 3bbd6a87f..a672c457a 100644 --- a/src/test/mir-opt/const_prop/mutable_variable.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/mutable_variable.main.ConstProp.diff @@ -19,7 +19,6 @@ 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 - nop; // 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/const_prop/mutable_variable.rs b/tests/mir-opt/const_prop/mutable_variable.rs index cb01719dd..cb01719dd 100644 --- a/src/test/mir-opt/const_prop/mutable_variable.rs +++ b/tests/mir-opt/const_prop/mutable_variable.rs diff --git a/src/test/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff b/tests/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff index fed6a98b9..f6bf52206 100644 --- a/src/test/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff @@ -21,7 +21,6 @@ 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 + _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 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/const_prop/mutable_variable_aggregate.rs b/tests/mir-opt/const_prop/mutable_variable_aggregate.rs index d4ff8d890..d4ff8d890 100644 --- a/src/test/mir-opt/const_prop/mutable_variable_aggregate.rs +++ b/tests/mir-opt/const_prop/mutable_variable_aggregate.rs diff --git a/src/test/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.ConstProp.diff b/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.ConstProp.diff index 90eebd8fe..213a70227 100644 --- a/src/test/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.ConstProp.diff @@ -26,7 +26,6 @@ ((*_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 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/const_prop/mutable_variable_aggregate_mut_ref.rs b/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs index 9060f7e9b..9060f7e9b 100644 --- a/src/test/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs +++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs diff --git a/src/test/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.diff b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.diff index 6eda503c1..149aa6290 100644 --- a/src/test/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.diff @@ -26,7 +26,6 @@ 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 - nop; // 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/const_prop/mutable_variable_aggregate_partial_read.rs b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs index cb59509ff..cb59509ff 100644 --- a/src/test/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs +++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs diff --git a/tests/mir-opt/const_prop/mutable_variable_no_prop.main.ConstProp.diff b/tests/mir-opt/const_prop/mutable_variable_no_prop.main.ConstProp.diff new file mode 100644 index 000000000..7fa29cccd --- /dev/null +++ b/tests/mir-opt/const_prop/mutable_variable_no_prop.main.ConstProp.diff @@ -0,0 +1,43 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + 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 mut _2: u32; // in scope 0 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19 + let mut _3: *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 _4: u32; // in scope 1 at $DIR/mutable_variable_no_prop.rs:+5:9: +5:10 + scope 2 { + } + scope 3 { + debug y => _4; // 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 2 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19 + StorageLive(_3); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19 + _3 = 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 + // + literal: Const { ty: *mut u32, val: Value(Scalar(alloc1)) } + _2 = (*_3); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19 + _1 = move _2; // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:9: +3:19 + StorageDead(_2); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:18: +3:19 + StorageDead(_3); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:19: +3:20 + StorageLive(_4); // scope 1 at $DIR/mutable_variable_no_prop.rs:+5:9: +5:10 + _4 = _1; // scope 1 at $DIR/mutable_variable_no_prop.rs:+5:13: +5:14 + StorageDead(_4); // 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) { + 42 42 42 42 │ BBBB + } + diff --git a/src/test/mir-opt/const_prop/mutable_variable_no_prop.rs b/tests/mir-opt/const_prop/mutable_variable_no_prop.rs index 8c23c5fcf..b69ec931a 100644 --- a/src/test/mir-opt/const_prop/mutable_variable_no_prop.rs +++ b/tests/mir-opt/const_prop/mutable_variable_no_prop.rs @@ -1,7 +1,7 @@ // unit-test // compile-flags: -O -static mut STATIC: u32 = 42; +static mut STATIC: u32 = 0x42424242; // EMIT_MIR mutable_variable_no_prop.main.ConstProp.diff fn main() { diff --git a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.diff b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.diff new file mode 100644 index 000000000..c3f77b960 --- /dev/null +++ b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.diff @@ -0,0 +1,57 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + 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 _2: 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 _5: i32; // in scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14 + let mut _6: i32; // in scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14 + scope 2 { + debug x => (i32, i32){ .0 => _5, .1 => _6, }; // in scope 2 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14 + let _3: i32; // in scope 2 at $DIR/mutable_variable_unprop_assign.rs:+4:9: +4:10 + scope 3 { + debug y => _3; // in scope 3 at $DIR/mutable_variable_unprop_assign.rs:+4:9: +4:10 + let _4: i32; // in scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:9: +5:10 + scope 4 { + debug z => _4; // 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:6:13: 6:16 + // + literal: Const { ty: fn() -> i32 {foo}, val: Value(<ZST>) } + } + + bb1: { + StorageLive(_5); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14 + StorageLive(_6); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14 + Deinit(_5); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:29: +2:35 + Deinit(_6); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:29: +2:35 + _5 = const 1_i32; // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:29: +2:35 + _6 = const 2_i32; // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:29: +2:35 + StorageLive(_2); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12 + _2 = _1; // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12 + _6 = move _2; // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:5: +3:12 + StorageDead(_2); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12 + StorageLive(_3); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+4:9: +4:10 + _3 = _6; // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+4:13: +4:16 + StorageLive(_4); // scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:9: +5:10 +- _4 = _5; // scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:13: +5:16 ++ _4 = const 1_i32; // scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:13: +5:16 + StorageDead(_4); // scope 3 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2 + StorageDead(_3); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2 + StorageDead(_5); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2 + StorageDead(_6); // 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 + } + } + diff --git a/src/test/mir-opt/const_prop/mutable_variable_unprop_assign.rs b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs index b077cfd3e..b077cfd3e 100644 --- a/src/test/mir-opt/const_prop/mutable_variable_unprop_assign.rs +++ b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs diff --git a/src/test/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.32bit.diff b/tests/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.32bit.diff index 7e8ebd31a..7c7aeac4c 100644 --- a/src/test/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.32bit.diff +++ b/tests/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.32bit.diff @@ -9,9 +9,7 @@ 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:36 - let mut _10: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 - let mut _11: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 + let mut _9: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 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 @@ -53,17 +51,12 @@ 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(_10); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 - StorageLive(_11); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 - Deinit(_10); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 - Deinit(_11); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 - _10 = const 12_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 - _11 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 -- _8 = _11; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:38 + StorageLive(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 + Deinit(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 + _9 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 +- _8 = _9; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:38 + _8 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:38 - StorageDead(_10); // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39 - StorageDead(_11); // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39 - nop; // scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +4:2 + StorageDead(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39 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 diff --git a/src/test/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.64bit.diff b/tests/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.64bit.diff index 7e8ebd31a..7c7aeac4c 100644 --- a/src/test/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.64bit.diff +++ b/tests/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.64bit.diff @@ -9,9 +9,7 @@ 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:36 - let mut _10: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 - let mut _11: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 + let mut _9: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 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 @@ -53,17 +51,12 @@ 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(_10); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 - StorageLive(_11); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 - Deinit(_10); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 - Deinit(_11); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 - _10 = const 12_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 - _11 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 -- _8 = _11; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:38 + StorageLive(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 + Deinit(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 + _9 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 +- _8 = _9; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:38 + _8 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:38 - StorageDead(_10); // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39 - StorageDead(_11); // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39 - nop; // scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +4:2 + StorageDead(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39 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 diff --git a/src/test/mir-opt/const_prop/optimizes_into_variable.main.PreCodegen.after.32bit.mir b/tests/mir-opt/const_prop/optimizes_into_variable.main.PreCodegen.after.32bit.mir index 9db87cfc8..9db87cfc8 100644 --- a/src/test/mir-opt/const_prop/optimizes_into_variable.main.PreCodegen.after.32bit.mir +++ b/tests/mir-opt/const_prop/optimizes_into_variable.main.PreCodegen.after.32bit.mir diff --git a/src/test/mir-opt/const_prop/optimizes_into_variable.main.PreCodegen.after.64bit.mir b/tests/mir-opt/const_prop/optimizes_into_variable.main.PreCodegen.after.64bit.mir index 9db87cfc8..9db87cfc8 100644 --- a/src/test/mir-opt/const_prop/optimizes_into_variable.main.PreCodegen.after.64bit.mir +++ b/tests/mir-opt/const_prop/optimizes_into_variable.main.PreCodegen.after.64bit.mir diff --git a/src/test/mir-opt/const_prop/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.diff b/tests/mir-opt/const_prop/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.diff index 3f9f3b2ea..3f9f3b2ea 100644 --- a/src/test/mir-opt/const_prop/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.diff +++ b/tests/mir-opt/const_prop/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.diff diff --git a/src/test/mir-opt/const_prop/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.diff b/tests/mir-opt/const_prop/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.diff index 3f9f3b2ea..3f9f3b2ea 100644 --- a/src/test/mir-opt/const_prop/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.diff +++ b/tests/mir-opt/const_prop/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.diff diff --git a/tests/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.mir b/tests/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.mir new file mode 100644 index 000000000..d926b9df7 --- /dev/null +++ b/tests/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.mir @@ -0,0 +1,27 @@ +// MIR for `main` after SimplifyLocals-final + +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 + } +} diff --git a/tests/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.mir b/tests/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.mir new file mode 100644 index 000000000..d926b9df7 --- /dev/null +++ b/tests/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.mir @@ -0,0 +1,27 @@ +// MIR for `main` after SimplifyLocals-final + +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 + } +} diff --git a/src/test/mir-opt/const_prop/optimizes_into_variable.rs b/tests/mir-opt/const_prop/optimizes_into_variable.rs index 025666548..abea07e20 100644 --- a/src/test/mir-opt/const_prop/optimizes_into_variable.rs +++ b/tests/mir-opt/const_prop/optimizes_into_variable.rs @@ -9,7 +9,7 @@ struct Point { // EMIT_MIR_FOR_EACH_BIT_WIDTH // EMIT_MIR optimizes_into_variable.main.ScalarReplacementOfAggregates.diff // EMIT_MIR optimizes_into_variable.main.ConstProp.diff -// EMIT_MIR optimizes_into_variable.main.SimplifyLocals.after.mir +// EMIT_MIR optimizes_into_variable.main.SimplifyLocals-final.after.mir // EMIT_MIR optimizes_into_variable.main.PreCodegen.after.mir fn main() { let x = 2 + 2; diff --git a/src/test/mir-opt/const_prop/read_immutable_static.main.ConstProp.diff b/tests/mir-opt/const_prop/read_immutable_static.main.ConstProp.diff index b9c283a54..388c6ca81 100644 --- a/src/test/mir-opt/const_prop/read_immutable_static.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/read_immutable_static.main.ConstProp.diff @@ -36,7 +36,6 @@ 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 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/const_prop/read_immutable_static.rs b/tests/mir-opt/const_prop/read_immutable_static.rs index 4f7afe6ca..4f7afe6ca 100644 --- a/src/test/mir-opt/const_prop/read_immutable_static.rs +++ b/tests/mir-opt/const_prop/read_immutable_static.rs diff --git a/src/test/mir-opt/const_prop/ref_deref.main.ConstProp.diff b/tests/mir-opt/const_prop/ref_deref.main.ConstProp.diff index 09ce67ff1..8a73f0390 100644 --- a/src/test/mir-opt/const_prop/ref_deref.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/ref_deref.main.ConstProp.diff @@ -13,7 +13,7 @@ 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: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/const_prop/ref_deref.main.PromoteTemps.diff b/tests/mir-opt/const_prop/ref_deref.main.PromoteTemps.diff index 902cd7850..015ec4d07 100644 --- a/src/test/mir-opt/const_prop/ref_deref.main.PromoteTemps.diff +++ b/tests/mir-opt/const_prop/ref_deref.main.PromoteTemps.diff @@ -16,7 +16,7 @@ - _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: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/tests/mir-opt/const_prop/ref_deref.rs b/tests/mir-opt/const_prop/ref_deref.rs new file mode 100644 index 000000000..d2549c8b6 --- /dev/null +++ b/tests/mir-opt/const_prop/ref_deref.rs @@ -0,0 +1,7 @@ +// compile-flags: -Zmir-enable-passes=-SimplifyLocals-before-const-prop +// EMIT_MIR ref_deref.main.PromoteTemps.diff +// EMIT_MIR ref_deref.main.ConstProp.diff + +fn main() { + *(&4); +} diff --git a/src/test/mir-opt/const_prop/ref_deref_project.main.ConstProp.diff b/tests/mir-opt/const_prop/ref_deref_project.main.ConstProp.diff index ec3d90433..ec3d90433 100644 --- a/src/test/mir-opt/const_prop/ref_deref_project.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/ref_deref_project.main.ConstProp.diff diff --git a/src/test/mir-opt/const_prop/ref_deref_project.main.PromoteTemps.diff b/tests/mir-opt/const_prop/ref_deref_project.main.PromoteTemps.diff index cd0616e65..cd0616e65 100644 --- a/src/test/mir-opt/const_prop/ref_deref_project.main.PromoteTemps.diff +++ b/tests/mir-opt/const_prop/ref_deref_project.main.PromoteTemps.diff diff --git a/tests/mir-opt/const_prop/ref_deref_project.rs b/tests/mir-opt/const_prop/ref_deref_project.rs new file mode 100644 index 000000000..2fdd4e153 --- /dev/null +++ b/tests/mir-opt/const_prop/ref_deref_project.rs @@ -0,0 +1,7 @@ +// compile-flags: -Zmir-enable-passes=-SimplifyLocals-before-const-prop +// EMIT_MIR ref_deref_project.main.PromoteTemps.diff +// EMIT_MIR ref_deref_project.main.ConstProp.diff + +fn main() { + *(&(4, 5).1); // This does not currently propagate (#67862) +} diff --git a/tests/mir-opt/const_prop/reify_fn_ptr.main.ConstProp.diff b/tests/mir-opt/const_prop/reify_fn_ptr.main.ConstProp.diff new file mode 100644 index 000000000..15c93f270 --- /dev/null +++ b/tests/mir-opt/const_prop/reify_fn_ptr.main.ConstProp.diff @@ -0,0 +1,24 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/reify_fn_ptr.rs:+0:11: +0:11 + let mut _1: usize; // in scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:26 + let mut _2: 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:26 + StorageLive(_2); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:17 + _2 = 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 + // + literal: Const { ty: fn() {main}, val: Value(<ZST>) } + _1 = move _2 as usize (PointerExposeAddress); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:26 + StorageDead(_2); // scope 0 at $DIR/reify_fn_ptr.rs:+1:25: +1:26 + StorageDead(_1); // scope 0 at $DIR/reify_fn_ptr.rs:+1:40: +1:41 + return; // scope 0 at $DIR/reify_fn_ptr.rs:+2:2: +2:2 + } + } + diff --git a/src/test/mir-opt/const_prop/reify_fn_ptr.rs b/tests/mir-opt/const_prop/reify_fn_ptr.rs index bfe2563ad..bfe2563ad 100644 --- a/src/test/mir-opt/const_prop/reify_fn_ptr.rs +++ b/tests/mir-opt/const_prop/reify_fn_ptr.rs diff --git a/src/test/mir-opt/const_prop/repeat.main.ConstProp.32bit.diff b/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.diff index 7c4977996..636032adb 100644 --- a/src/test/mir-opt/const_prop/repeat.main.ConstProp.32bit.diff +++ b/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.diff @@ -35,7 +35,6 @@ 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 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/const_prop/repeat.main.ConstProp.64bit.diff b/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.diff index 7c4977996..636032adb 100644 --- a/src/test/mir-opt/const_prop/repeat.main.ConstProp.64bit.diff +++ b/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.diff @@ -35,7 +35,6 @@ 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 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/const_prop/repeat.rs b/tests/mir-opt/const_prop/repeat.rs index 36d9b9fc6..36d9b9fc6 100644 --- a/src/test/mir-opt/const_prop/repeat.rs +++ b/tests/mir-opt/const_prop/repeat.rs diff --git a/src/test/mir-opt/const_prop/return_place.add.ConstProp.diff b/tests/mir-opt/const_prop/return_place.add.ConstProp.diff index 5ebd8a520..5ebd8a520 100644 --- a/src/test/mir-opt/const_prop/return_place.add.ConstProp.diff +++ b/tests/mir-opt/const_prop/return_place.add.ConstProp.diff diff --git a/src/test/mir-opt/const_prop/return_place.add.PreCodegen.before.mir b/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.mir index ececd9942..ececd9942 100644 --- a/src/test/mir-opt/const_prop/return_place.add.PreCodegen.before.mir +++ b/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.mir diff --git a/src/test/mir-opt/const_prop/return_place.rs b/tests/mir-opt/const_prop/return_place.rs index 06a853696..06a853696 100644 --- a/src/test/mir-opt/const_prop/return_place.rs +++ b/tests/mir-opt/const_prop/return_place.rs diff --git a/src/test/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.diff b/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.diff index 5920937e0..d518eff04 100644 --- a/src/test/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.diff @@ -27,7 +27,6 @@ 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 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/const_prop/scalar_literal_propagation.rs b/tests/mir-opt/const_prop/scalar_literal_propagation.rs index 8724e4d57..8724e4d57 100644 --- a/src/test/mir-opt/const_prop/scalar_literal_propagation.rs +++ b/tests/mir-opt/const_prop/scalar_literal_propagation.rs diff --git a/src/test/mir-opt/const_prop/slice_len.main.ConstProp.32bit.diff b/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.diff index 624376769..9017fd18e 100644 --- a/src/test/mir-opt/const_prop/slice_len.main.ConstProp.32bit.diff +++ b/tests/mir-opt/const_prop/slice_len.main.ConstProp.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,20 +20,18 @@ 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: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 _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 +- _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 ++ _7 = const 3_usize; // 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 } diff --git a/src/test/mir-opt/const_prop/slice_len.main.ConstProp.64bit.diff b/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.diff index 624376769..9017fd18e 100644 --- a/src/test/mir-opt/const_prop/slice_len.main.ConstProp.64bit.diff +++ b/tests/mir-opt/const_prop/slice_len.main.ConstProp.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,20 +20,18 @@ 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: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 _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 +- _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 ++ _7 = const 3_usize; // 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 } diff --git a/tests/mir-opt/const_prop/slice_len.rs b/tests/mir-opt/const_prop/slice_len.rs new file mode 100644 index 000000000..eaaf34b96 --- /dev/null +++ b/tests/mir-opt/const_prop/slice_len.rs @@ -0,0 +1,7 @@ +// compile-flags: -Zmir-enable-passes=-SimplifyLocals-before-const-prop +// EMIT_MIR_FOR_EACH_BIT_WIDTH + +// EMIT_MIR slice_len.main.ConstProp.diff +fn main() { + (&[1u32, 2, 3] as &[u32])[1]; +} diff --git a/src/test/mir-opt/const_prop/switch_int.main.ConstProp.diff b/tests/mir-opt/const_prop/switch_int.main.ConstProp.diff index 9d7c2784d..ddc1a4493 100644 --- a/src/test/mir-opt/const_prop/switch_int.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/switch_int.main.ConstProp.diff @@ -8,8 +8,8 @@ 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(_1) -> [1_i32: bb2, otherwise: bb1]; // scope 0 at $DIR/switch_int.rs:+1:5: +1:12 -+ switchInt(const 1_i32) -> [1_i32: bb2, otherwise: bb1]; // scope 0 at $DIR/switch_int.rs:+1:5: +1:12 +- switchInt(_1) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/switch_int.rs:+1:5: +1:12 ++ switchInt(const 1_i32) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/switch_int.rs:+1:5: +1:12 } bb1: { diff --git a/src/test/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.diff b/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.diff index 74f9eafe4..09c47ee6e 100644 --- a/src/test/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.diff +++ b/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.diff @@ -8,7 +8,7 @@ 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 +- switchInt(const 1_i32) -> [1: 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 } diff --git a/src/test/mir-opt/const_prop/switch_int.rs b/tests/mir-opt/const_prop/switch_int.rs index d7319eca1..d7319eca1 100644 --- a/src/test/mir-opt/const_prop/switch_int.rs +++ b/tests/mir-opt/const_prop/switch_int.rs diff --git a/src/test/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.diff b/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.diff index a0603c60d..e4c92b617 100644 --- a/src/test/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.diff @@ -28,7 +28,6 @@ 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 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/const_prop/tuple_literal_propagation.rs b/tests/mir-opt/const_prop/tuple_literal_propagation.rs index e644baec4..e644baec4 100644 --- a/src/test/mir-opt/const_prop/tuple_literal_propagation.rs +++ b/tests/mir-opt/const_prop/tuple_literal_propagation.rs diff --git a/tests/mir-opt/const_prop_miscompile.bar.ConstProp.diff b/tests/mir-opt/const_prop_miscompile.bar.ConstProp.diff new file mode 100644 index 000000000..ea9fec0aa --- /dev/null +++ b/tests/mir-opt/const_prop_miscompile.bar.ConstProp.diff @@ -0,0 +1,37 @@ +- // MIR for `bar` before ConstProp ++ // MIR for `bar` after ConstProp + + fn bar() -> () { + let mut _0: (); // return place in scope 0 at $DIR/const_prop_miscompile.rs:+0:10: +0:10 + let mut _1: (i32,); // in scope 0 at $DIR/const_prop_miscompile.rs:+1:9: +1:14 + let mut _2: *mut i32; // in scope 0 at $DIR/const_prop_miscompile.rs:+3:10: +3:22 + let mut _4: i32; // in scope 0 at $DIR/const_prop_miscompile.rs:+5:13: +5:20 + scope 1 { + debug v => _1; // in scope 1 at $DIR/const_prop_miscompile.rs:+1:9: +1:14 + let _3: bool; // in scope 1 at $DIR/const_prop_miscompile.rs:+5:9: +5:10 + scope 2 { + } + scope 3 { + debug y => _3; // in scope 3 at $DIR/const_prop_miscompile.rs:+5:9: +5:10 + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/const_prop_miscompile.rs:+1:9: +1:14 + Deinit(_1); // scope 0 at $DIR/const_prop_miscompile.rs:+1:17: +1:21 + (_1.0: i32) = const 1_i32; // scope 0 at $DIR/const_prop_miscompile.rs:+1:17: +1:21 + StorageLive(_2); // scope 2 at $DIR/const_prop_miscompile.rs:+3:10: +3:22 + _2 = &raw mut (_1.0: i32); // scope 2 at $DIR/const_prop_miscompile.rs:+3:10: +3:22 + (*_2) = const 5_i32; // scope 2 at $DIR/const_prop_miscompile.rs:+3:9: +3:26 + StorageDead(_2); // scope 2 at $DIR/const_prop_miscompile.rs:+3:26: +3:27 + StorageLive(_3); // scope 1 at $DIR/const_prop_miscompile.rs:+5:9: +5:10 + StorageLive(_4); // scope 1 at $DIR/const_prop_miscompile.rs:+5:13: +5:20 + _4 = (_1.0: i32); // scope 1 at $DIR/const_prop_miscompile.rs:+5:15: +5:18 + _3 = Eq(move _4, const 5_i32); // scope 1 at $DIR/const_prop_miscompile.rs:+5:13: +5:25 + StorageDead(_4); // scope 1 at $DIR/const_prop_miscompile.rs:+5:24: +5:25 + StorageDead(_3); // scope 1 at $DIR/const_prop_miscompile.rs:+6:1: +6:2 + StorageDead(_1); // scope 0 at $DIR/const_prop_miscompile.rs:+6:1: +6:2 + return; // scope 0 at $DIR/const_prop_miscompile.rs:+6:2: +6:2 + } + } + diff --git a/src/test/mir-opt/const_prop_miscompile.foo.ConstProp.diff b/tests/mir-opt/const_prop_miscompile.foo.ConstProp.diff index e8bd98cf8..043f40474 100644 --- a/src/test/mir-opt/const_prop_miscompile.foo.ConstProp.diff +++ b/tests/mir-opt/const_prop_miscompile.foo.ConstProp.diff @@ -27,7 +27,6 @@ _4 = (_1.0: i32); // scope 1 at $DIR/const_prop_miscompile.rs:+3:15: +3:18 _3 = Eq(move _4, const 5_i32); // scope 1 at $DIR/const_prop_miscompile.rs:+3:13: +3:25 StorageDead(_4); // scope 1 at $DIR/const_prop_miscompile.rs:+3:24: +3:25 - nop; // scope 0 at $DIR/const_prop_miscompile.rs:+0:10: +4:2 StorageDead(_3); // scope 1 at $DIR/const_prop_miscompile.rs:+4:1: +4:2 StorageDead(_1); // scope 0 at $DIR/const_prop_miscompile.rs:+4:1: +4:2 return; // scope 0 at $DIR/const_prop_miscompile.rs:+4:2: +4:2 diff --git a/src/test/mir-opt/const_prop_miscompile.rs b/tests/mir-opt/const_prop_miscompile.rs index bc54556b3..bc54556b3 100644 --- a/src/test/mir-opt/const_prop_miscompile.rs +++ b/tests/mir-opt/const_prop_miscompile.rs |