From da4a40f81650222d86fa070aad87b5d20f8596e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jannis=20Christopher=20K=C3=B6hl?= Date: Tue, 25 Oct 2022 02:27:27 +0200 Subject: [PATCH] Remove copy of current const prop tests and add a few new tests --- .../mir-opt/dataflow-const-prop/checked.rs | 2 +- ...erit_overflow.main.DataflowConstProp.diff} | 30 ++-- ...flow_checks_use.rs => inherit_overflow.rs} | 4 +- .../dataflow-const-prop/issue_81605.rs | 1 + .../aggregate.main.DataflowConstProp.diff | 32 ----- .../dataflow-const-prop/previous/aggregate.rs | 7 - ...ay_index.main.DataflowConstProp.32bit.diff | 37 ----- ...ay_index.main.DataflowConstProp.64bit.diff | 37 ----- .../previous/array_index.rs | 7 - ...op_div_by_zero.main.DataflowConstProp.diff | 54 ------- .../previous/bad_op_div_by_zero.rs | 7 - ...op_mod_by_zero.main.DataflowConstProp.diff | 54 ------- .../previous/bad_op_mod_by_zero.rs | 7 - ...r_slices.main.DataflowConstProp.32bit.diff | 56 -------- ...r_slices.main.DataflowConstProp.64bit.diff | 56 -------- .../previous/bad_op_unsafe_oob_for_slices.rs | 10 -- .../previous/boolean_identities.rs | 11 -- ...ean_identities.test.DataflowConstProp.diff | 30 ---- .../boxes.main.DataflowConstProp.diff | 58 -------- .../dataflow-const-prop/previous/boxes.rs | 14 -- .../previous/cast.main.DataflowConstProp.diff | 28 ---- .../dataflow-const-prop/previous/cast.rs | 8 -- .../checked_add.main.DataflowConstProp.diff | 27 ---- .../previous/checked_add.rs | 7 - ...ils_gracefully.main.DataflowConstProp.diff | 44 ------ .../previous/const_prop_fails_gracefully.rs | 10 -- .../previous/control-flow-simplification.rs | 21 --- ...implification.hello.DataflowConstProp.diff | 32 ----- ...simplification.hello.PreCodegen.before.mir | 9 -- ...riminant.main.DataflowConstProp.32bit.diff | 50 ------- ...riminant.main.DataflowConstProp.64bit.diff | 50 ------- .../previous/discriminant.rs | 13 -- .../indirect.main.DataflowConstProp.diff | 33 ----- .../dataflow-const-prop/previous/indirect.rs | 7 - ...valid_constant.main.DataflowConstProp.diff | 74 ---------- .../previous/invalid_constant.rs | 44 ------ .../previous/issue-66971.rs | 18 --- .../previous/issue-67019.rs | 13 -- .../issue_66971.main.DataflowConstProp.diff | 33 ----- .../issue_67019.main.DataflowConstProp.diff | 33 ----- ...ay_index.main.DataflowConstProp.32bit.diff | 35 ----- ...ay_index.main.DataflowConstProp.64bit.diff | 35 ----- .../previous/large_array_index.rs | 7 - .../previous/mult_by_zero.rs | 10 -- .../mult_by_zero.test.DataflowConstProp.diff | 17 --- ...table_variable.main.DataflowConstProp.diff | 28 ---- .../previous/mutable_variable.rs | 8 -- ...able_aggregate.main.DataflowConstProp.diff | 29 ---- .../previous/mutable_variable_aggregate.rs | 8 -- ...regate_mut_ref.main.DataflowConstProp.diff | 36 ----- .../mutable_variable_aggregate_mut_ref.rs | 9 -- ...e_partial_read.main.DataflowConstProp.diff | 35 ----- ...mutable_variable_aggregate_partial_read.rs | 14 -- ...riable_no_prop.main.DataflowConstProp.diff | 48 ------- .../previous/mutable_variable_no_prop.rs | 12 -- ..._unprop_assign.main.DataflowConstProp.diff | 54 ------- .../mutable_variable_unprop_assign.rs | 15 -- ...variable.main.DataflowConstProp.32bit.diff | 61 -------- ...variable.main.DataflowConstProp.64bit.diff | 61 -------- ...riable.main.SimplifyLocals.after.32bit.mir | 27 ---- ...riable.main.SimplifyLocals.after.64bit.mir | 27 ---- .../previous/optimizes_into_variable.rs | 16 --- ...mutable_static.main.DataflowConstProp.diff | 45 ------ .../previous/read_immutable_static.rs | 8 -- .../ref_deref.main.DataflowConstProp.diff | 26 ---- .../previous/ref_deref.main.PromoteTemps.diff | 30 ---- .../dataflow-const-prop/previous/ref_deref.rs | 7 - ..._deref_project.main.DataflowConstProp.diff | 26 ---- .../ref_deref_project.main.PromoteTemps.diff | 30 ---- .../previous/ref_deref_project.rs | 7 - .../reify_fn_ptr.main.DataflowConstProp.diff | 29 ---- .../previous/reify_fn_ptr.rs | 6 - .../repeat.main.DataflowConstProp.32bit.diff | 41 ------ .../repeat.main.DataflowConstProp.64bit.diff | 41 ------ .../dataflow-const-prop/previous/repeat.rs | 7 - .../return_place.add.DataflowConstProp.diff | 20 --- .../return_place.add.PreCodegen.before.mir | 16 --- .../previous/return_place.rs | 12 -- ...al_propagation.main.DataflowConstProp.diff | 35 ----- .../previous/scalar_literal_propagation.rs | 9 -- ...lice_len.main.DataflowConstProp.32bit.diff | 48 ------- ...lice_len.main.DataflowConstProp.64bit.diff | 48 ------- .../dataflow-const-prop/previous/slice_len.rs | 7 - .../switch_int.main.DataflowConstProp.diff | 33 ----- ...mplifyConstCondition-after-const-prop.diff | 34 ----- .../previous/switch_int.rs | 11 -- ...al_propagation.main.DataflowConstProp.diff | 35 ----- .../previous/tuple_literal_propagation.rs | 10 -- .../promoted.main.DataflowConstProp.diff | 2 +- .../mir-opt/dataflow-const-prop/promoted.rs | 1 + .../recursive.main.DataflowConstProp.diff | 132 ------------------ .../mir-opt/dataflow-const-prop/recursive.rs | 24 ---- .../ref_mut.main.DataflowConstProp.diff | 2 +- .../mir-opt/dataflow-const-prop/ref_mut.rs | 1 + .../self_assign.main.DataflowConstProp.diff | 52 +++++++ .../dataflow-const-prop/self_assign.rs | 13 ++ ...elf_assign_add.main.DataflowConstProp.diff | 23 +++ .../dataflow-const-prop/self_assign_add.rs | 9 ++ .../static_ref.main.DataflowConstProp.diff | 62 ++++---- .../mir-opt/dataflow-const-prop/static_ref.rs | 2 + .../terminator.main.DataflowConstProp.diff | 2 +- .../mir-opt/dataflow-const-prop/terminator.rs | 1 + .../tuple.main.DataflowConstProp.diff | 86 ++++++++++++ src/test/mir-opt/dataflow-const-prop/tuple.rs | 12 ++ .../unnamed.main.DataflowConstProp.diff | 38 ----- .../mir-opt/dataflow-const-prop/unnamed.rs | 10 -- 106 files changed, 253 insertions(+), 2500 deletions(-) rename src/test/mir-opt/dataflow-const-prop/{inherit_overflow_checks_use.main.DataflowConstProp.diff => inherit_overflow.main.DataflowConstProp.diff} (80%) rename src/test/mir-opt/dataflow-const-prop/{inherit_overflow_checks_use.rs => inherit_overflow.rs} (65%) delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/aggregate.main.DataflowConstProp.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/aggregate.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/array_index.main.DataflowConstProp.32bit.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/array_index.main.DataflowConstProp.64bit.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/array_index.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/bad_op_div_by_zero.main.DataflowConstProp.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/bad_op_div_by_zero.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/bad_op_mod_by_zero.main.DataflowConstProp.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/bad_op_mod_by_zero.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/bad_op_unsafe_oob_for_slices.main.DataflowConstProp.32bit.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/bad_op_unsafe_oob_for_slices.main.DataflowConstProp.64bit.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/bad_op_unsafe_oob_for_slices.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/boolean_identities.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/boolean_identities.test.DataflowConstProp.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/boxes.main.DataflowConstProp.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/boxes.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/cast.main.DataflowConstProp.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/cast.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/checked_add.main.DataflowConstProp.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/checked_add.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/const_prop_fails_gracefully.main.DataflowConstProp.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/const_prop_fails_gracefully.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/control-flow-simplification.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/control_flow_simplification.hello.DataflowConstProp.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/control_flow_simplification.hello.PreCodegen.before.mir delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/discriminant.main.DataflowConstProp.32bit.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/discriminant.main.DataflowConstProp.64bit.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/discriminant.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/indirect.main.DataflowConstProp.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/indirect.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/invalid_constant.main.DataflowConstProp.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/invalid_constant.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/issue-66971.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/issue-67019.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/issue_66971.main.DataflowConstProp.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/issue_67019.main.DataflowConstProp.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/large_array_index.main.DataflowConstProp.32bit.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/large_array_index.main.DataflowConstProp.64bit.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/large_array_index.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/mult_by_zero.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/mult_by_zero.test.DataflowConstProp.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/mutable_variable.main.DataflowConstProp.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/mutable_variable.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate.main.DataflowConstProp.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate_mut_ref.main.DataflowConstProp.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate_mut_ref.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate_partial_read.main.DataflowConstProp.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate_partial_read.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_no_prop.main.DataflowConstProp.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_no_prop.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_unprop_assign.main.DataflowConstProp.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_unprop_assign.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/optimizes_into_variable.main.DataflowConstProp.32bit.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/optimizes_into_variable.main.DataflowConstProp.64bit.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/optimizes_into_variable.main.SimplifyLocals.after.32bit.mir delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/optimizes_into_variable.main.SimplifyLocals.after.64bit.mir delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/optimizes_into_variable.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/read_immutable_static.main.DataflowConstProp.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/read_immutable_static.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/ref_deref.main.DataflowConstProp.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/ref_deref.main.PromoteTemps.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/ref_deref.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/ref_deref_project.main.DataflowConstProp.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/ref_deref_project.main.PromoteTemps.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/ref_deref_project.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/reify_fn_ptr.main.DataflowConstProp.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/reify_fn_ptr.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/repeat.main.DataflowConstProp.32bit.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/repeat.main.DataflowConstProp.64bit.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/repeat.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/return_place.add.DataflowConstProp.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/return_place.add.PreCodegen.before.mir delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/return_place.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/scalar_literal_propagation.main.DataflowConstProp.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/scalar_literal_propagation.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/slice_len.main.DataflowConstProp.32bit.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/slice_len.main.DataflowConstProp.64bit.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/slice_len.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/switch_int.main.DataflowConstProp.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/switch_int.main.SimplifyConstCondition-after-const-prop.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/switch_int.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/tuple_literal_propagation.main.DataflowConstProp.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/previous/tuple_literal_propagation.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/recursive.main.DataflowConstProp.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/recursive.rs create mode 100644 src/test/mir-opt/dataflow-const-prop/self_assign.main.DataflowConstProp.diff create mode 100644 src/test/mir-opt/dataflow-const-prop/self_assign.rs create mode 100644 src/test/mir-opt/dataflow-const-prop/self_assign_add.main.DataflowConstProp.diff create mode 100644 src/test/mir-opt/dataflow-const-prop/self_assign_add.rs create mode 100644 src/test/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.diff create mode 100644 src/test/mir-opt/dataflow-const-prop/tuple.rs delete mode 100644 src/test/mir-opt/dataflow-const-prop/unnamed.main.DataflowConstProp.diff delete mode 100644 src/test/mir-opt/dataflow-const-prop/unnamed.rs diff --git a/src/test/mir-opt/dataflow-const-prop/checked.rs b/src/test/mir-opt/dataflow-const-prop/checked.rs index ae457af72c0..8c99fc95eb1 100644 --- a/src/test/mir-opt/dataflow-const-prop/checked.rs +++ b/src/test/mir-opt/dataflow-const-prop/checked.rs @@ -1,5 +1,5 @@ // unit-test: DataflowConstProp -// compile-flags: -C overflow-checks=on +// compile-flags: -Zunsound-mir-opts -Coverflow-checks=on // EMIT_MIR checked.main.DataflowConstProp.diff #[allow(arithmetic_overflow)] diff --git a/src/test/mir-opt/dataflow-const-prop/inherit_overflow_checks_use.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.diff similarity index 80% rename from src/test/mir-opt/dataflow-const-prop/inherit_overflow_checks_use.main.DataflowConstProp.diff rename to src/test/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.diff index 53c7ec41680..bf4557ed3d9 100644 --- a/src/test/mir-opt/dataflow-const-prop/inherit_overflow_checks_use.main.DataflowConstProp.diff +++ b/src/test/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.diff @@ -2,13 +2,13 @@ + // MIR for `main` after DataflowConstProp fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/inherit_overflow_checks_use.rs:+0:11: +0:11 - let mut _1: u8; // in scope 0 at $DIR/inherit_overflow_checks_use.rs:+3:13: +3:47 - let mut _2: u8; // in scope 0 at $DIR/inherit_overflow_checks_use.rs:+3:13: +3:47 - let mut _3: u8; // in scope 0 at $DIR/inherit_overflow_checks_use.rs:+3:13: +3:47 + let mut _0: (); // return place in scope 0 at $DIR/inherit_overflow.rs:+0:11: +0:11 + let mut _1: u8; // in scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 + let mut _2: u8; // in scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 + let mut _3: u8; // in scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 scope 1 { } - scope 2 (inlined ::add) { // at $DIR/inherit_overflow_checks_use.rs:7:13: 7:47 + scope 2 (inlined ::add) { // at $DIR/inherit_overflow.rs:7:13: 7:47 debug self => _2; // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL debug other => _3; // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL let mut _4: u8; // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL @@ -17,11 +17,11 @@ } bb0: { - StorageLive(_1); // scope 0 at $DIR/inherit_overflow_checks_use.rs:+3:13: +3:47 - StorageLive(_2); // scope 0 at $DIR/inherit_overflow_checks_use.rs:+3:13: +3:47 - _2 = const u8::MAX; // scope 0 at $DIR/inherit_overflow_checks_use.rs:+3:13: +3:47 - StorageLive(_3); // scope 0 at $DIR/inherit_overflow_checks_use.rs:+3:13: +3:47 - _3 = const 1_u8; // scope 0 at $DIR/inherit_overflow_checks_use.rs:+3:13: +3:47 + StorageLive(_1); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 + StorageLive(_2); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 + _2 = const u8::MAX; // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 + StorageLive(_3); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 + _3 = const 1_u8; // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 StorageLive(_4); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL _4 = const u8::MAX; // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL StorageLive(_5); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL @@ -35,11 +35,11 @@ + _1 = const 0_u8; // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL StorageDead(_5); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL StorageDead(_4); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL - StorageDead(_3); // scope 0 at $DIR/inherit_overflow_checks_use.rs:+3:13: +3:47 - StorageDead(_2); // scope 0 at $DIR/inherit_overflow_checks_use.rs:+3:13: +3:47 - StorageDead(_1); // scope 0 at $DIR/inherit_overflow_checks_use.rs:+3:47: +3:48 - nop; // scope 0 at $DIR/inherit_overflow_checks_use.rs:+0:11: +4:2 - return; // scope 0 at $DIR/inherit_overflow_checks_use.rs:+4:2: +4:2 + StorageDead(_3); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 + StorageDead(_2); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 + StorageDead(_1); // scope 0 at $DIR/inherit_overflow.rs:+3:47: +3:48 + nop; // scope 0 at $DIR/inherit_overflow.rs:+0:11: +4:2 + return; // scope 0 at $DIR/inherit_overflow.rs:+4:2: +4:2 } } diff --git a/src/test/mir-opt/dataflow-const-prop/inherit_overflow_checks_use.rs b/src/test/mir-opt/dataflow-const-prop/inherit_overflow.rs similarity index 65% rename from src/test/mir-opt/dataflow-const-prop/inherit_overflow_checks_use.rs rename to src/test/mir-opt/dataflow-const-prop/inherit_overflow.rs index d4fcb1d7705..3f6329dfd1d 100644 --- a/src/test/mir-opt/dataflow-const-prop/inherit_overflow_checks_use.rs +++ b/src/test/mir-opt/dataflow-const-prop/inherit_overflow.rs @@ -1,6 +1,6 @@ -// compile-flags: -C overflow-checks=off +// compile-flags: -Coverflow-checks=off -Zunsound-mir-opts -// EMIT_MIR inherit_overflow_checks_use.main.DataflowConstProp.diff +// EMIT_MIR inherit_overflow.main.DataflowConstProp.diff fn main() { // After inlining, this will contain a `CheckedBinaryOp`. The overflow // must be ignored by the constant propagation to avoid triggering a panic. diff --git a/src/test/mir-opt/dataflow-const-prop/issue_81605.rs b/src/test/mir-opt/dataflow-const-prop/issue_81605.rs index d75e2a28bef..2829d32c905 100644 --- a/src/test/mir-opt/dataflow-const-prop/issue_81605.rs +++ b/src/test/mir-opt/dataflow-const-prop/issue_81605.rs @@ -1,4 +1,5 @@ // unit-test: DataflowConstProp +// compile-flags: -Zunsound-mir-opts // EMIT_MIR issue_81605.f.DataflowConstProp.diff fn f() -> usize { diff --git a/src/test/mir-opt/dataflow-const-prop/previous/aggregate.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/previous/aggregate.main.DataflowConstProp.diff deleted file mode 100644 index 8c35b5ca420..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/aggregate.main.DataflowConstProp.diff +++ /dev/null @@ -1,32 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/aggregate.rs:+0:11: +0:11 - let _1: i32; // in scope 0 at $DIR/aggregate.rs:+1:9: +1:10 - let mut _2: i32; // in scope 0 at $DIR/aggregate.rs:+1:13: +1:24 - let mut _3: (i32, i32, i32); // in scope 0 at $DIR/aggregate.rs:+1:13: +1:22 - scope 1 { - debug x => _1; // in scope 1 at $DIR/aggregate.rs:+1:9: +1:10 - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/aggregate.rs:+1:9: +1:10 - StorageLive(_2); // scope 0 at $DIR/aggregate.rs:+1:13: +1:24 - StorageLive(_3); // scope 0 at $DIR/aggregate.rs:+1:13: +1:22 - Deinit(_3); // scope 0 at $DIR/aggregate.rs:+1:13: +1:22 - (_3.0: i32) = const 0_i32; // scope 0 at $DIR/aggregate.rs:+1:13: +1:22 - (_3.1: i32) = const 1_i32; // scope 0 at $DIR/aggregate.rs:+1:13: +1:22 - (_3.2: i32) = const 2_i32; // scope 0 at $DIR/aggregate.rs:+1:13: +1:22 -- _2 = (_3.1: i32); // scope 0 at $DIR/aggregate.rs:+1:13: +1:24 -- _1 = Add(move _2, const 0_i32); // scope 0 at $DIR/aggregate.rs:+1:13: +1:28 -+ _2 = const 1_i32; // scope 0 at $DIR/aggregate.rs:+1:13: +1:24 -+ _1 = const 1_i32; // scope 0 at $DIR/aggregate.rs:+1:13: +1:28 - StorageDead(_2); // scope 0 at $DIR/aggregate.rs:+1:27: +1:28 - StorageDead(_3); // scope 0 at $DIR/aggregate.rs:+1:28: +1:29 - _0 = const (); // scope 0 at $DIR/aggregate.rs:+0:11: +2:2 - StorageDead(_1); // scope 0 at $DIR/aggregate.rs:+2:1: +2:2 - return; // scope 0 at $DIR/aggregate.rs:+2:2: +2:2 - } - } - diff --git a/src/test/mir-opt/dataflow-const-prop/previous/aggregate.rs b/src/test/mir-opt/dataflow-const-prop/previous/aggregate.rs deleted file mode 100644 index bdfa922cf5c..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/aggregate.rs +++ /dev/null @@ -1,7 +0,0 @@ -// unit-test: DataflowConstProp -// compile-flags: -O - -// EMIT_MIR aggregate.main.DataflowConstProp.diff -fn main() { - let x = (0, 1, 2).1 + 0; -} diff --git a/src/test/mir-opt/dataflow-const-prop/previous/array_index.main.DataflowConstProp.32bit.diff b/src/test/mir-opt/dataflow-const-prop/previous/array_index.main.DataflowConstProp.32bit.diff deleted file mode 100644 index 00eb9d0e200..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/array_index.main.DataflowConstProp.32bit.diff +++ /dev/null @@ -1,37 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/array_index.rs:+0:11: +0:11 - let _1: u32; // in scope 0 at $DIR/array_index.rs:+1:9: +1:10 - let mut _2: [u32; 4]; // in scope 0 at $DIR/array_index.rs:+1:18: +1:30 - let _3: usize; // in scope 0 at $DIR/array_index.rs:+1:31: +1:32 - let mut _4: usize; // in scope 0 at $DIR/array_index.rs:+1:18: +1:33 - let mut _5: bool; // in scope 0 at $DIR/array_index.rs:+1:18: +1:33 - scope 1 { - debug x => _1; // in scope 1 at $DIR/array_index.rs:+1:9: +1:10 - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/array_index.rs:+1:9: +1:10 - StorageLive(_2); // scope 0 at $DIR/array_index.rs:+1:18: +1:30 - _2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32]; // scope 0 at $DIR/array_index.rs:+1:18: +1:30 - StorageLive(_3); // scope 0 at $DIR/array_index.rs:+1:31: +1:32 - _3 = const 2_usize; // scope 0 at $DIR/array_index.rs:+1:31: +1:32 - _4 = Len(_2); // scope 0 at $DIR/array_index.rs:+1:18: +1:33 -- _5 = Lt(_3, _4); // scope 0 at $DIR/array_index.rs:+1:18: +1:33 -- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/array_index.rs:+1:18: +1:33 -+ _5 = Lt(const 2_usize, _4); // scope 0 at $DIR/array_index.rs:+1:18: +1:33 -+ assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, const 2_usize) -> bb1; // scope 0 at $DIR/array_index.rs:+1:18: +1:33 - } - - bb1: { - _1 = _2[_3]; // scope 0 at $DIR/array_index.rs:+1:18: +1:33 - StorageDead(_3); // scope 0 at $DIR/array_index.rs:+1:33: +1:34 - StorageDead(_2); // scope 0 at $DIR/array_index.rs:+1:33: +1:34 - _0 = const (); // scope 0 at $DIR/array_index.rs:+0:11: +2:2 - StorageDead(_1); // scope 0 at $DIR/array_index.rs:+2:1: +2:2 - return; // scope 0 at $DIR/array_index.rs:+2:2: +2:2 - } - } - diff --git a/src/test/mir-opt/dataflow-const-prop/previous/array_index.main.DataflowConstProp.64bit.diff b/src/test/mir-opt/dataflow-const-prop/previous/array_index.main.DataflowConstProp.64bit.diff deleted file mode 100644 index 00eb9d0e200..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/array_index.main.DataflowConstProp.64bit.diff +++ /dev/null @@ -1,37 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/array_index.rs:+0:11: +0:11 - let _1: u32; // in scope 0 at $DIR/array_index.rs:+1:9: +1:10 - let mut _2: [u32; 4]; // in scope 0 at $DIR/array_index.rs:+1:18: +1:30 - let _3: usize; // in scope 0 at $DIR/array_index.rs:+1:31: +1:32 - let mut _4: usize; // in scope 0 at $DIR/array_index.rs:+1:18: +1:33 - let mut _5: bool; // in scope 0 at $DIR/array_index.rs:+1:18: +1:33 - scope 1 { - debug x => _1; // in scope 1 at $DIR/array_index.rs:+1:9: +1:10 - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/array_index.rs:+1:9: +1:10 - StorageLive(_2); // scope 0 at $DIR/array_index.rs:+1:18: +1:30 - _2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32]; // scope 0 at $DIR/array_index.rs:+1:18: +1:30 - StorageLive(_3); // scope 0 at $DIR/array_index.rs:+1:31: +1:32 - _3 = const 2_usize; // scope 0 at $DIR/array_index.rs:+1:31: +1:32 - _4 = Len(_2); // scope 0 at $DIR/array_index.rs:+1:18: +1:33 -- _5 = Lt(_3, _4); // scope 0 at $DIR/array_index.rs:+1:18: +1:33 -- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/array_index.rs:+1:18: +1:33 -+ _5 = Lt(const 2_usize, _4); // scope 0 at $DIR/array_index.rs:+1:18: +1:33 -+ assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, const 2_usize) -> bb1; // scope 0 at $DIR/array_index.rs:+1:18: +1:33 - } - - bb1: { - _1 = _2[_3]; // scope 0 at $DIR/array_index.rs:+1:18: +1:33 - StorageDead(_3); // scope 0 at $DIR/array_index.rs:+1:33: +1:34 - StorageDead(_2); // scope 0 at $DIR/array_index.rs:+1:33: +1:34 - _0 = const (); // scope 0 at $DIR/array_index.rs:+0:11: +2:2 - StorageDead(_1); // scope 0 at $DIR/array_index.rs:+2:1: +2:2 - return; // scope 0 at $DIR/array_index.rs:+2:2: +2:2 - } - } - diff --git a/src/test/mir-opt/dataflow-const-prop/previous/array_index.rs b/src/test/mir-opt/dataflow-const-prop/previous/array_index.rs deleted file mode 100644 index 3cd7ddf20a7..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/array_index.rs +++ /dev/null @@ -1,7 +0,0 @@ -// unit-test: DataflowConstProp -// EMIT_MIR_FOR_EACH_BIT_WIDTH - -// EMIT_MIR array_index.main.DataflowConstProp.diff -fn main() { - let x: u32 = [0, 1, 2, 3][2]; -} diff --git a/src/test/mir-opt/dataflow-const-prop/previous/bad_op_div_by_zero.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/previous/bad_op_div_by_zero.main.DataflowConstProp.diff deleted file mode 100644 index 1744b7b976a..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/bad_op_div_by_zero.main.DataflowConstProp.diff +++ /dev/null @@ -1,54 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/bad_op_div_by_zero.rs:+0:11: +0:11 - let _1: i32; // in scope 0 at $DIR/bad_op_div_by_zero.rs:+1:9: +1:10 - let mut _3: i32; // in scope 0 at $DIR/bad_op_div_by_zero.rs:+2:18: +2:19 - let mut _4: bool; // in scope 0 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 - let mut _5: bool; // in scope 0 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 - let mut _6: bool; // in scope 0 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 - let mut _7: bool; // in scope 0 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 - scope 1 { - debug y => _1; // in scope 1 at $DIR/bad_op_div_by_zero.rs:+1:9: +1:10 - let _2: i32; // in scope 1 at $DIR/bad_op_div_by_zero.rs:+2:9: +2:11 - scope 2 { - debug _z => _2; // in scope 2 at $DIR/bad_op_div_by_zero.rs:+2:9: +2:11 - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/bad_op_div_by_zero.rs:+1:9: +1:10 - _1 = const 0_i32; // scope 0 at $DIR/bad_op_div_by_zero.rs:+1:13: +1:14 - StorageLive(_2); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:9: +2:11 - StorageLive(_3); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:18: +2:19 -- _3 = _1; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:18: +2:19 -- _4 = Eq(_3, const 0_i32); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 -- assert(!move _4, "attempt to divide `{}` by zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 -+ _3 = const 0_i32; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:18: +2:19 -+ _4 = const true; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 -+ assert(!const true, "attempt to divide `{}` by zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 - } - - bb1: { -- _5 = Eq(_3, const -1_i32); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 -- _6 = Eq(const 1_i32, const i32::MIN); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 -- _7 = BitAnd(move _5, move _6); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 -- assert(!move _7, "attempt to compute `{} / {}`, which would overflow", const 1_i32, _3) -> bb2; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 -+ _5 = const false; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 -+ _6 = const false; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 -+ _7 = const false; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 -+ assert(!const false, "attempt to compute `{} / {}`, which would overflow", const 1_i32, const 0_i32) -> bb2; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 - } - - bb2: { -- _2 = Div(const 1_i32, move _3); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 -+ _2 = Div(const 1_i32, const 0_i32); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 - StorageDead(_3); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:18: +2:19 - _0 = const (); // scope 0 at $DIR/bad_op_div_by_zero.rs:+0:11: +3:2 - StorageDead(_2); // scope 1 at $DIR/bad_op_div_by_zero.rs:+3:1: +3:2 - StorageDead(_1); // scope 0 at $DIR/bad_op_div_by_zero.rs:+3:1: +3:2 - return; // scope 0 at $DIR/bad_op_div_by_zero.rs:+3:2: +3:2 - } - } - diff --git a/src/test/mir-opt/dataflow-const-prop/previous/bad_op_div_by_zero.rs b/src/test/mir-opt/dataflow-const-prop/previous/bad_op_div_by_zero.rs deleted file mode 100644 index ddf195b2c8a..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/bad_op_div_by_zero.rs +++ /dev/null @@ -1,7 +0,0 @@ -// unit-test: DataflowConstProp -// EMIT_MIR bad_op_div_by_zero.main.DataflowConstProp.diff -#[allow(unconditional_panic)] -fn main() { - let y = 0; - let _z = 1 / y; -} 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 deleted file mode 100644 index cc8dea75c9c..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/bad_op_mod_by_zero.main.DataflowConstProp.diff +++ /dev/null @@ -1,54 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/bad_op_mod_by_zero.rs:+0:11: +0:11 - let _1: i32; // in scope 0 at $DIR/bad_op_mod_by_zero.rs:+1:9: +1:10 - let mut _3: i32; // in scope 0 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19 - let mut _4: bool; // in scope 0 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 - let mut _5: bool; // in scope 0 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 - let mut _6: bool; // in scope 0 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 - let mut _7: bool; // in scope 0 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 - scope 1 { - debug y => _1; // in scope 1 at $DIR/bad_op_mod_by_zero.rs:+1:9: +1:10 - let _2: i32; // in scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:9: +2:11 - scope 2 { - debug _z => _2; // in scope 2 at $DIR/bad_op_mod_by_zero.rs:+2:9: +2:11 - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/bad_op_mod_by_zero.rs:+1:9: +1:10 - _1 = const 0_i32; // scope 0 at $DIR/bad_op_mod_by_zero.rs:+1:13: +1:14 - StorageLive(_2); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:9: +2:11 - StorageLive(_3); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19 -- _3 = _1; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19 -- _4 = Eq(_3, const 0_i32); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 -- assert(!move _4, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 -+ _3 = const 0_i32; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19 -+ _4 = const true; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 -+ assert(!const true, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 - } - - bb1: { -- _5 = Eq(_3, const -1_i32); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 -- _6 = Eq(const 1_i32, const i32::MIN); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 -- _7 = BitAnd(move _5, move _6); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 -- assert(!move _7, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, _3) -> bb2; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 -+ _5 = const false; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 -+ _6 = const false; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 -+ _7 = const false; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 -+ assert(!const false, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, const 0_i32) -> bb2; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 - } - - bb2: { -- _2 = Rem(const 1_i32, move _3); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 -+ _2 = Rem(const 1_i32, const 0_i32); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 - StorageDead(_3); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19 - _0 = const (); // scope 0 at $DIR/bad_op_mod_by_zero.rs:+0:11: +3:2 - StorageDead(_2); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+3:1: +3:2 - StorageDead(_1); // scope 0 at $DIR/bad_op_mod_by_zero.rs:+3:1: +3:2 - return; // scope 0 at $DIR/bad_op_mod_by_zero.rs:+3:2: +3:2 - } - } - 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 deleted file mode 100644 index ad30a5b6242..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/bad_op_mod_by_zero.rs +++ /dev/null @@ -1,7 +0,0 @@ -// unit-test: DataflowConstProp -// EMIT_MIR bad_op_mod_by_zero.main.DataflowConstProp.diff -#[allow(unconditional_panic)] -fn main() { - let y = 0; - let _z = 1 % y; -} 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 deleted file mode 100644 index ce1524af765..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/bad_op_unsafe_oob_for_slices.main.DataflowConstProp.32bit.diff +++ /dev/null @@ -1,56 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+0:11: +0:11 - let _1: *const [i32]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10 - let mut _2: *const [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 - let _3: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 - let _4: [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:26: +1:35 - let _6: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24 - let mut _7: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 - let mut _8: bool; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 - let mut _9: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 - scope 1 { - debug a => _1; // in scope 1 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10 - scope 2 { - let _5: i32; // in scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15 - scope 3 { - debug _b => _5; // in scope 3 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15 - } - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10 - StorageLive(_2); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 - StorageLive(_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 - _9 = const _; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 - // mir::Constant - // + span: $DIR/bad_op_unsafe_oob_for_slices.rs:6:25: 6:35 - // + literal: Const { ty: &[i32; 3], val: Unevaluated(main, [], Some(promoted[0])) } - _3 = &(*_9); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 - _2 = &raw const (*_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 - _1 = move _2 as *const [i32] (Pointer(Unsize)); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 - StorageDead(_2); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:34: +1:35 - StorageDead(_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:35: +1:36 - StorageLive(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15 - StorageLive(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24 - _6 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24 - _7 = Len((*_1)); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 -- _8 = Lt(_6, _7); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 -- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 -+ _8 = Lt(const 3_usize, _7); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 -+ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 3_usize) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 - } - - bb1: { - _5 = (*_1)[_6]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 - StorageDead(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:25: +3:26 - _0 = const (); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+2:5: +4:6 - StorageDead(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+4:5: +4:6 - StorageDead(_1); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+5:1: +5:2 - return; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+5:2: +5:2 - } - } - 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 deleted file mode 100644 index ce1524af765..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/bad_op_unsafe_oob_for_slices.main.DataflowConstProp.64bit.diff +++ /dev/null @@ -1,56 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+0:11: +0:11 - let _1: *const [i32]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10 - let mut _2: *const [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 - let _3: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 - let _4: [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:26: +1:35 - let _6: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24 - let mut _7: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 - let mut _8: bool; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 - let mut _9: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 - scope 1 { - debug a => _1; // in scope 1 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10 - scope 2 { - let _5: i32; // in scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15 - scope 3 { - debug _b => _5; // in scope 3 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15 - } - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10 - StorageLive(_2); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 - StorageLive(_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 - _9 = const _; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 - // mir::Constant - // + span: $DIR/bad_op_unsafe_oob_for_slices.rs:6:25: 6:35 - // + literal: Const { ty: &[i32; 3], val: Unevaluated(main, [], Some(promoted[0])) } - _3 = &(*_9); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 - _2 = &raw const (*_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 - _1 = move _2 as *const [i32] (Pointer(Unsize)); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 - StorageDead(_2); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:34: +1:35 - StorageDead(_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:35: +1:36 - StorageLive(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15 - StorageLive(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24 - _6 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24 - _7 = Len((*_1)); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 -- _8 = Lt(_6, _7); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 -- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 -+ _8 = Lt(const 3_usize, _7); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 -+ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 3_usize) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 - } - - bb1: { - _5 = (*_1)[_6]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 - StorageDead(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:25: +3:26 - _0 = const (); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+2:5: +4:6 - StorageDead(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+4:5: +4:6 - StorageDead(_1); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+5:1: +5:2 - return; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+5:2: +5:2 - } - } - 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 deleted file mode 100644 index c97257e6d8f..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/bad_op_unsafe_oob_for_slices.rs +++ /dev/null @@ -1,10 +0,0 @@ -// unit-test: DataflowConstProp -// EMIT_MIR_FOR_EACH_BIT_WIDTH -// EMIT_MIR bad_op_unsafe_oob_for_slices.main.DataflowConstProp.diff -#[allow(unconditional_panic)] -fn main() { - let a: *const [_] = &[1, 2, 3]; - unsafe { - let _b = (*a)[3]; - } -} diff --git a/src/test/mir-opt/dataflow-const-prop/previous/boolean_identities.rs b/src/test/mir-opt/dataflow-const-prop/previous/boolean_identities.rs deleted file mode 100644 index 578f9830cf2..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/boolean_identities.rs +++ /dev/null @@ -1,11 +0,0 @@ -// unit-test: DataflowConstProp -// compile-flags: -O -Zmir-opt-level=4 - -// EMIT_MIR boolean_identities.test.DataflowConstProp.diff -pub fn test(x: bool, y: bool) -> bool { - (y | true) & (x & false) -} - -fn main() { - test(true, false); -} diff --git a/src/test/mir-opt/dataflow-const-prop/previous/boolean_identities.test.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/previous/boolean_identities.test.DataflowConstProp.diff deleted file mode 100644 index 307324d5768..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/boolean_identities.test.DataflowConstProp.diff +++ /dev/null @@ -1,30 +0,0 @@ -- // MIR for `test` before DataflowConstProp -+ // MIR for `test` after DataflowConstProp - - fn test(_1: bool, _2: bool) -> bool { - debug x => _1; // in scope 0 at $DIR/boolean_identities.rs:+0:13: +0:14 - debug y => _2; // in scope 0 at $DIR/boolean_identities.rs:+0:22: +0:23 - let mut _0: bool; // return place in scope 0 at $DIR/boolean_identities.rs:+0:34: +0:38 - let mut _3: bool; // in scope 0 at $DIR/boolean_identities.rs:+1:5: +1:15 - let mut _4: bool; // in scope 0 at $DIR/boolean_identities.rs:+1:6: +1:7 - let mut _5: bool; // in scope 0 at $DIR/boolean_identities.rs:+1:18: +1:29 - let mut _6: bool; // in scope 0 at $DIR/boolean_identities.rs:+1:19: +1:20 - - bb0: { - StorageLive(_3); // scope 0 at $DIR/boolean_identities.rs:+1:5: +1:15 - StorageLive(_4); // scope 0 at $DIR/boolean_identities.rs:+1:6: +1:7 - _4 = _2; // scope 0 at $DIR/boolean_identities.rs:+1:6: +1:7 - _3 = const true; // scope 0 at $DIR/boolean_identities.rs:+1:5: +1:15 - StorageDead(_4); // scope 0 at $DIR/boolean_identities.rs:+1:14: +1:15 - StorageLive(_5); // scope 0 at $DIR/boolean_identities.rs:+1:18: +1:29 - StorageLive(_6); // scope 0 at $DIR/boolean_identities.rs:+1:19: +1:20 - _6 = _1; // scope 0 at $DIR/boolean_identities.rs:+1:19: +1:20 - _5 = const false; // scope 0 at $DIR/boolean_identities.rs:+1:18: +1:29 - StorageDead(_6); // scope 0 at $DIR/boolean_identities.rs:+1:28: +1:29 - _0 = const false; // scope 0 at $DIR/boolean_identities.rs:+1:5: +1:29 - StorageDead(_5); // scope 0 at $DIR/boolean_identities.rs:+1:28: +1:29 - StorageDead(_3); // scope 0 at $DIR/boolean_identities.rs:+1:28: +1:29 - return; // scope 0 at $DIR/boolean_identities.rs:+2:2: +2:2 - } - } - diff --git a/src/test/mir-opt/dataflow-const-prop/previous/boxes.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/previous/boxes.main.DataflowConstProp.diff deleted file mode 100644 index 501108a7abc..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/boxes.main.DataflowConstProp.diff +++ /dev/null @@ -1,58 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/boxes.rs:+0:11: +0:11 - let _1: i32; // in scope 0 at $DIR/boxes.rs:+1:9: +1:10 - let mut _2: i32; // in scope 0 at $DIR/boxes.rs:+1:13: +1:22 - let mut _3: std::boxed::Box; // in scope 0 at $DIR/boxes.rs:+1:14: +1:22 - let mut _4: usize; // in scope 0 at $DIR/boxes.rs:+1:14: +1:22 - let mut _5: usize; // in scope 0 at $DIR/boxes.rs:+1:14: +1:22 - let mut _6: *mut u8; // in scope 0 at $DIR/boxes.rs:+1:14: +1:22 - let mut _7: std::boxed::Box; // in scope 0 at $DIR/boxes.rs:+1:14: +1:22 - let mut _8: *const i32; // in scope 0 at $DIR/boxes.rs:+1:14: +1:22 - let mut _9: *const i32; // in scope 0 at $DIR/boxes.rs:+1:14: +1:22 - scope 1 { - debug x => _1; // in scope 1 at $DIR/boxes.rs:+1:9: +1:10 - } - scope 2 { - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/boxes.rs:+1:9: +1:10 - StorageLive(_2); // scope 0 at $DIR/boxes.rs:+1:13: +1:22 - StorageLive(_3); // scope 0 at $DIR/boxes.rs:+1:14: +1:22 - _4 = SizeOf(i32); // scope 2 at $DIR/boxes.rs:+1:14: +1:22 - _5 = AlignOf(i32); // scope 2 at $DIR/boxes.rs:+1:14: +1:22 - _6 = alloc::alloc::exchange_malloc(move _4, move _5) -> bb1; // scope 2 at $DIR/boxes.rs:+1:14: +1:22 - // mir::Constant - // + span: $DIR/boxes.rs:13:14: 13:22 - // + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value() } - } - - bb1: { - StorageLive(_7); // scope 0 at $DIR/boxes.rs:+1:14: +1:22 - _7 = ShallowInitBox(move _6, i32); // scope 0 at $DIR/boxes.rs:+1:14: +1:22 - _8 = (((_7.0: std::ptr::Unique).0: std::ptr::NonNull).0: *const i32); // scope 0 at $DIR/boxes.rs:+1:19: +1:21 - (*_8) = const 42_i32; // scope 0 at $DIR/boxes.rs:+1:19: +1:21 - _3 = move _7; // scope 0 at $DIR/boxes.rs:+1:14: +1:22 - StorageDead(_7); // scope 0 at $DIR/boxes.rs:+1:21: +1:22 - _9 = (((_3.0: std::ptr::Unique).0: std::ptr::NonNull).0: *const i32); // scope 0 at $DIR/boxes.rs:+1:13: +1:22 - _2 = (*_9); // scope 0 at $DIR/boxes.rs:+1:13: +1:22 - _1 = Add(move _2, const 0_i32); // scope 0 at $DIR/boxes.rs:+1:13: +1:26 - StorageDead(_2); // scope 0 at $DIR/boxes.rs:+1:25: +1:26 - drop(_3) -> [return: bb2, unwind: bb3]; // scope 0 at $DIR/boxes.rs:+1:26: +1:27 - } - - bb2: { - StorageDead(_3); // scope 0 at $DIR/boxes.rs:+1:26: +1:27 - _0 = const (); // scope 0 at $DIR/boxes.rs:+0:11: +2:2 - StorageDead(_1); // scope 0 at $DIR/boxes.rs:+2:1: +2:2 - return; // scope 0 at $DIR/boxes.rs:+2:2: +2:2 - } - - bb3 (cleanup): { - resume; // scope 0 at $DIR/boxes.rs:+0:1: +2:2 - } - } - diff --git a/src/test/mir-opt/dataflow-const-prop/previous/boxes.rs b/src/test/mir-opt/dataflow-const-prop/previous/boxes.rs deleted file mode 100644 index 8b0c13c2eb6..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/boxes.rs +++ /dev/null @@ -1,14 +0,0 @@ -// unit-test: DataflowConstProp -// compile-flags: -O -// ignore-emscripten compiled with panic=abort by default -// ignore-wasm32 -// ignore-wasm64 - -#![feature(box_syntax)] - -// Note: this test verifies that we, in fact, do not const prop `box` - -// EMIT_MIR boxes.main.DataflowConstProp.diff -fn main() { - let x = *(box 42) + 0; -} diff --git a/src/test/mir-opt/dataflow-const-prop/previous/cast.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/previous/cast.main.DataflowConstProp.diff deleted file mode 100644 index 3fd9fb5331b..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/cast.main.DataflowConstProp.diff +++ /dev/null @@ -1,28 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/cast.rs:+0:11: +0:11 - let _1: u32; // in scope 0 at $DIR/cast.rs:+1:9: +1:10 - scope 1 { - debug x => _1; // in scope 1 at $DIR/cast.rs:+1:9: +1:10 - let _2: u8; // in scope 1 at $DIR/cast.rs:+3:9: +3:10 - scope 2 { - debug y => _2; // in scope 2 at $DIR/cast.rs:+3:9: +3:10 - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/cast.rs:+1:9: +1:10 -- _1 = const 42_u8 as u32 (IntToInt); // scope 0 at $DIR/cast.rs:+1:13: +1:24 -+ _1 = const 42_u32; // scope 0 at $DIR/cast.rs:+1:13: +1:24 - StorageLive(_2); // scope 1 at $DIR/cast.rs:+3:9: +3:10 -- _2 = const 42_u32 as u8 (IntToInt); // scope 1 at $DIR/cast.rs:+3:13: +3:24 -+ _2 = const 42_u8; // scope 1 at $DIR/cast.rs:+3:13: +3:24 - _0 = const (); // scope 0 at $DIR/cast.rs:+0:11: +4:2 - StorageDead(_2); // scope 1 at $DIR/cast.rs:+4:1: +4:2 - StorageDead(_1); // scope 0 at $DIR/cast.rs:+4:1: +4:2 - return; // scope 0 at $DIR/cast.rs:+4:2: +4:2 - } - } - diff --git a/src/test/mir-opt/dataflow-const-prop/previous/cast.rs b/src/test/mir-opt/dataflow-const-prop/previous/cast.rs deleted file mode 100644 index 25cc1839ff0..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/cast.rs +++ /dev/null @@ -1,8 +0,0 @@ -// unit-test: DataflowConstProp -// EMIT_MIR cast.main.DataflowConstProp.diff - -fn main() { - let x = 42u8 as u32; - - let y = 42u32 as u8; -} diff --git a/src/test/mir-opt/dataflow-const-prop/previous/checked_add.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/previous/checked_add.main.DataflowConstProp.diff deleted file mode 100644 index 5371e049664..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/checked_add.main.DataflowConstProp.diff +++ /dev/null @@ -1,27 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/checked_add.rs:+0:11: +0:11 - let _1: u32; // in scope 0 at $DIR/checked_add.rs:+1:9: +1:10 - let mut _2: (u32, bool); // in scope 0 at $DIR/checked_add.rs:+1:18: +1:23 - scope 1 { - debug x => _1; // in scope 1 at $DIR/checked_add.rs:+1:9: +1:10 - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/checked_add.rs:+1:9: +1:10 - _2 = CheckedAdd(const 1_u32, const 1_u32); // scope 0 at $DIR/checked_add.rs:+1:18: +1:23 -- assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 1_u32, const 1_u32) -> bb1; // scope 0 at $DIR/checked_add.rs:+1:18: +1:23 -+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 1_u32, const 1_u32) -> bb1; // scope 0 at $DIR/checked_add.rs:+1:18: +1:23 - } - - bb1: { -- _1 = move (_2.0: u32); // scope 0 at $DIR/checked_add.rs:+1:18: +1:23 -+ _1 = const 2_u32; // scope 0 at $DIR/checked_add.rs:+1:18: +1:23 - _0 = const (); // scope 0 at $DIR/checked_add.rs:+0:11: +2:2 - StorageDead(_1); // scope 0 at $DIR/checked_add.rs:+2:1: +2:2 - return; // scope 0 at $DIR/checked_add.rs:+2:2: +2:2 - } - } - diff --git a/src/test/mir-opt/dataflow-const-prop/previous/checked_add.rs b/src/test/mir-opt/dataflow-const-prop/previous/checked_add.rs deleted file mode 100644 index e7cb0470989..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/checked_add.rs +++ /dev/null @@ -1,7 +0,0 @@ -// unit-test: DataflowConstProp -// compile-flags: -C overflow-checks=on - -// EMIT_MIR checked_add.main.DataflowConstProp.diff -fn main() { - let x: u32 = 1 + 1; -} diff --git a/src/test/mir-opt/dataflow-const-prop/previous/const_prop_fails_gracefully.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/previous/const_prop_fails_gracefully.main.DataflowConstProp.diff deleted file mode 100644 index 38a5eecb8e8..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/const_prop_fails_gracefully.main.DataflowConstProp.diff +++ /dev/null @@ -1,44 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/const_prop_fails_gracefully.rs:+0:11: +0:11 - let _1: usize; // in scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:9: +2:10 - let mut _2: *const i32; // in scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:30 - let _3: &i32; // in scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:16 - let _4: (); // in scope 0 at $DIR/const_prop_fails_gracefully.rs:+3:5: +3:12 - let mut _5: usize; // in scope 0 at $DIR/const_prop_fails_gracefully.rs:+3:10: +3:11 - scope 1 { - debug x => _1; // in scope 1 at $DIR/const_prop_fails_gracefully.rs:+2:9: +2:10 - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:9: +2:10 - StorageLive(_2); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:30 - StorageLive(_3); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:16 - _3 = const _; // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:16 - // mir::Constant - // + span: $DIR/const_prop_fails_gracefully.rs:8:13: 8:16 - // + literal: Const { ty: &i32, val: Unevaluated(FOO, [], None) } - _2 = &raw const (*_3); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:16 - _1 = move _2 as usize (PointerExposeAddress); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:39 - StorageDead(_2); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:38: +2:39 - StorageDead(_3); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:39: +2:40 - StorageLive(_4); // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:5: +3:12 - StorageLive(_5); // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:10: +3:11 - _5 = _1; // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:10: +3:11 - _4 = read(move _5) -> bb1; // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:5: +3:12 - // mir::Constant - // + span: $DIR/const_prop_fails_gracefully.rs:9:5: 9:9 - // + literal: Const { ty: fn(usize) {read}, val: Value() } - } - - bb1: { - StorageDead(_5); // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:11: +3:12 - StorageDead(_4); // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:12: +3:13 - _0 = const (); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+0:11: +4:2 - StorageDead(_1); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+4:1: +4:2 - return; // scope 0 at $DIR/const_prop_fails_gracefully.rs:+4:2: +4:2 - } - } - diff --git a/src/test/mir-opt/dataflow-const-prop/previous/const_prop_fails_gracefully.rs b/src/test/mir-opt/dataflow-const-prop/previous/const_prop_fails_gracefully.rs deleted file mode 100644 index 59b2f9caf2e..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/const_prop_fails_gracefully.rs +++ /dev/null @@ -1,10 +0,0 @@ -// unit-test: DataflowConstProp -#[inline(never)] -fn read(_: usize) {} - -// EMIT_MIR const_prop_fails_gracefully.main.DataflowConstProp.diff -fn main() { - const FOO: &i32 = &1; - let x = FOO as *const i32 as usize; - read(x); -} diff --git a/src/test/mir-opt/dataflow-const-prop/previous/control-flow-simplification.rs b/src/test/mir-opt/dataflow-const-prop/previous/control-flow-simplification.rs deleted file mode 100644 index e1269628d2f..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/control-flow-simplification.rs +++ /dev/null @@ -1,21 +0,0 @@ -// unit-test: DataflowConstProp -// compile-flags: -Zmir-opt-level=1 - -trait NeedsDrop: Sized { - const NEEDS: bool = std::mem::needs_drop::(); -} - -impl NeedsDrop for This {} - -// EMIT_MIR control_flow_simplification.hello.DataflowConstProp.diff -// EMIT_MIR control_flow_simplification.hello.PreCodegen.before.mir -fn hello() { - if ::NEEDS { - panic!() - } -} - -pub fn main() { - hello::<()>(); - hello::>(); -} diff --git a/src/test/mir-opt/dataflow-const-prop/previous/control_flow_simplification.hello.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/previous/control_flow_simplification.hello.DataflowConstProp.diff deleted file mode 100644 index d990c3b07e5..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/control_flow_simplification.hello.DataflowConstProp.diff +++ /dev/null @@ -1,32 +0,0 @@ -- // MIR for `hello` before DataflowConstProp -+ // MIR for `hello` after DataflowConstProp - - fn hello() -> () { - let mut _0: (); // return place in scope 0 at $DIR/control-flow-simplification.rs:+0:15: +0:15 - let mut _1: bool; // in scope 0 at $DIR/control-flow-simplification.rs:+1:8: +1:21 - let mut _2: !; // in scope 0 at $SRC_DIR/std/src/panic.rs:LL:COL - - bb0: { - StorageLive(_1); // scope 0 at $DIR/control-flow-simplification.rs:+1:8: +1:21 - _1 = const _; // scope 0 at $DIR/control-flow-simplification.rs:+1:8: +1:21 - switchInt(const false) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/control-flow-simplification.rs:+1:8: +1:21 - } - - bb1: { - StorageLive(_2); // scope 0 at $SRC_DIR/std/src/panic.rs:LL:COL - _2 = begin_panic::<&str>(const "explicit panic"); // scope 0 at $SRC_DIR/std/src/panic.rs:LL:COL - // mir::Constant - // + span: $SRC_DIR/std/src/panic.rs:LL:COL - // + literal: Const { ty: fn(&str) -> ! {begin_panic::<&str>}, val: Value() } - // mir::Constant - // + span: $SRC_DIR/std/src/panic.rs:LL:COL - // + literal: Const { ty: &str, val: Value(Slice(..)) } - } - - bb2: { - nop; // scope 0 at $DIR/control-flow-simplification.rs:+3:6: +3:6 - StorageDead(_1); // scope 0 at $DIR/control-flow-simplification.rs:+3:5: +3:6 - return; // scope 0 at $DIR/control-flow-simplification.rs:+4:2: +4:2 - } - } - diff --git a/src/test/mir-opt/dataflow-const-prop/previous/control_flow_simplification.hello.PreCodegen.before.mir b/src/test/mir-opt/dataflow-const-prop/previous/control_flow_simplification.hello.PreCodegen.before.mir deleted file mode 100644 index 442ae807761..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/control_flow_simplification.hello.PreCodegen.before.mir +++ /dev/null @@ -1,9 +0,0 @@ -// MIR for `hello` before PreCodegen - -fn hello() -> () { - let mut _0: (); // return place in scope 0 at $DIR/control-flow-simplification.rs:+0:15: +0:15 - - bb0: { - return; // scope 0 at $DIR/control-flow-simplification.rs:+4:2: +4:2 - } -} diff --git a/src/test/mir-opt/dataflow-const-prop/previous/discriminant.main.DataflowConstProp.32bit.diff b/src/test/mir-opt/dataflow-const-prop/previous/discriminant.main.DataflowConstProp.32bit.diff deleted file mode 100644 index f98270b3ff0..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/discriminant.main.DataflowConstProp.32bit.diff +++ /dev/null @@ -1,50 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/discriminant.rs:+0:11: +0:11 - let _1: i32; // in scope 0 at $DIR/discriminant.rs:+1:9: +1:10 - let mut _2: i32; // in scope 0 at $DIR/discriminant.rs:+1:13: +1:64 - let mut _3: std::option::Option; // in scope 0 at $DIR/discriminant.rs:+1:34: +1:44 - let mut _4: isize; // in scope 0 at $DIR/discriminant.rs:+1:21: +1:31 - scope 1 { - debug x => _1; // in scope 1 at $DIR/discriminant.rs:+1:9: +1:10 - } - scope 2 { - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/discriminant.rs:+1:9: +1:10 - StorageLive(_2); // scope 0 at $DIR/discriminant.rs:+1:13: +1:64 - StorageLive(_3); // scope 2 at $DIR/discriminant.rs:+1:34: +1:44 - Deinit(_3); // scope 2 at $DIR/discriminant.rs:+1:34: +1:44 - ((_3 as Some).0: bool) = const true; // scope 2 at $DIR/discriminant.rs:+1:34: +1:44 - discriminant(_3) = 1; // scope 2 at $DIR/discriminant.rs:+1:34: +1:44 - _4 = discriminant(_3); // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 - switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 - } - - bb1: { - switchInt(((_3 as Some).0: bool)) -> [false: bb3, otherwise: bb2]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 - } - - bb2: { - _2 = const 42_i32; // scope 2 at $DIR/discriminant.rs:+1:47: +1:49 - goto -> bb4; // scope 0 at $DIR/discriminant.rs:+1:13: +1:64 - } - - bb3: { - _2 = const 10_i32; // scope 0 at $DIR/discriminant.rs:+1:59: +1:61 - goto -> bb4; // scope 0 at $DIR/discriminant.rs:+1:13: +1:64 - } - - bb4: { - _1 = Add(move _2, const 0_i32); // scope 0 at $DIR/discriminant.rs:+1:13: +1:68 - StorageDead(_2); // scope 0 at $DIR/discriminant.rs:+1:67: +1:68 - StorageDead(_3); // scope 0 at $DIR/discriminant.rs:+1:68: +1:69 - _0 = const (); // scope 0 at $DIR/discriminant.rs:+0:11: +2:2 - StorageDead(_1); // scope 0 at $DIR/discriminant.rs:+2:1: +2:2 - return; // scope 0 at $DIR/discriminant.rs:+2:2: +2:2 - } - } - diff --git a/src/test/mir-opt/dataflow-const-prop/previous/discriminant.main.DataflowConstProp.64bit.diff b/src/test/mir-opt/dataflow-const-prop/previous/discriminant.main.DataflowConstProp.64bit.diff deleted file mode 100644 index f98270b3ff0..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/discriminant.main.DataflowConstProp.64bit.diff +++ /dev/null @@ -1,50 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/discriminant.rs:+0:11: +0:11 - let _1: i32; // in scope 0 at $DIR/discriminant.rs:+1:9: +1:10 - let mut _2: i32; // in scope 0 at $DIR/discriminant.rs:+1:13: +1:64 - let mut _3: std::option::Option; // in scope 0 at $DIR/discriminant.rs:+1:34: +1:44 - let mut _4: isize; // in scope 0 at $DIR/discriminant.rs:+1:21: +1:31 - scope 1 { - debug x => _1; // in scope 1 at $DIR/discriminant.rs:+1:9: +1:10 - } - scope 2 { - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/discriminant.rs:+1:9: +1:10 - StorageLive(_2); // scope 0 at $DIR/discriminant.rs:+1:13: +1:64 - StorageLive(_3); // scope 2 at $DIR/discriminant.rs:+1:34: +1:44 - Deinit(_3); // scope 2 at $DIR/discriminant.rs:+1:34: +1:44 - ((_3 as Some).0: bool) = const true; // scope 2 at $DIR/discriminant.rs:+1:34: +1:44 - discriminant(_3) = 1; // scope 2 at $DIR/discriminant.rs:+1:34: +1:44 - _4 = discriminant(_3); // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 - switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 - } - - bb1: { - switchInt(((_3 as Some).0: bool)) -> [false: bb3, otherwise: bb2]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 - } - - bb2: { - _2 = const 42_i32; // scope 2 at $DIR/discriminant.rs:+1:47: +1:49 - goto -> bb4; // scope 0 at $DIR/discriminant.rs:+1:13: +1:64 - } - - bb3: { - _2 = const 10_i32; // scope 0 at $DIR/discriminant.rs:+1:59: +1:61 - goto -> bb4; // scope 0 at $DIR/discriminant.rs:+1:13: +1:64 - } - - bb4: { - _1 = Add(move _2, const 0_i32); // scope 0 at $DIR/discriminant.rs:+1:13: +1:68 - StorageDead(_2); // scope 0 at $DIR/discriminant.rs:+1:67: +1:68 - StorageDead(_3); // scope 0 at $DIR/discriminant.rs:+1:68: +1:69 - _0 = const (); // scope 0 at $DIR/discriminant.rs:+0:11: +2:2 - StorageDead(_1); // scope 0 at $DIR/discriminant.rs:+2:1: +2:2 - return; // scope 0 at $DIR/discriminant.rs:+2:2: +2:2 - } - } - diff --git a/src/test/mir-opt/dataflow-const-prop/previous/discriminant.rs b/src/test/mir-opt/dataflow-const-prop/previous/discriminant.rs deleted file mode 100644 index 5399bc25997..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/discriminant.rs +++ /dev/null @@ -1,13 +0,0 @@ -// unit-test: DataflowConstProp -// compile-flags: -O - -// FIXME(wesleywiser): Ideally, we could const-prop away all of this and just be left with -// `let x = 42` but that doesn't work because const-prop doesn't support `Operand::Indirect` -// and `InterpCx::eval_place()` always forces an allocation which creates the `Indirect`. -// Fixing either of those will allow us to const-prop this away. - -// EMIT_MIR_FOR_EACH_BIT_WIDTH -// EMIT_MIR discriminant.main.DataflowConstProp.diff -fn main() { - let x = (if let Some(true) = Some(true) { 42 } else { 10 }) + 0; -} diff --git a/src/test/mir-opt/dataflow-const-prop/previous/indirect.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/previous/indirect.main.DataflowConstProp.diff deleted file mode 100644 index 80deb02c77f..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/indirect.main.DataflowConstProp.diff +++ /dev/null @@ -1,33 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/indirect.rs:+0:11: +0:11 - let _1: u8; // in scope 0 at $DIR/indirect.rs:+1:9: +1:10 - let mut _2: u8; // in scope 0 at $DIR/indirect.rs:+1:13: +1:25 - let mut _3: (u8, bool); // in scope 0 at $DIR/indirect.rs:+1:13: +1:29 - scope 1 { - debug x => _1; // in scope 1 at $DIR/indirect.rs:+1:9: +1:10 - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/indirect.rs:+1:9: +1:10 - StorageLive(_2); // scope 0 at $DIR/indirect.rs:+1:13: +1:25 -- _2 = const 2_u32 as u8 (IntToInt); // scope 0 at $DIR/indirect.rs:+1:13: +1:25 -- _3 = CheckedAdd(_2, const 1_u8); // scope 0 at $DIR/indirect.rs:+1:13: +1:29 -- assert(!move (_3.1: bool), "attempt to compute `{} + {}`, which would overflow", move _2, const 1_u8) -> bb1; // scope 0 at $DIR/indirect.rs:+1:13: +1:29 -+ _2 = const 2_u8; // scope 0 at $DIR/indirect.rs:+1:13: +1:25 -+ _3 = CheckedAdd(const 2_u8, const 1_u8); // scope 0 at $DIR/indirect.rs:+1:13: +1:29 -+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_u8, const 1_u8) -> bb1; // scope 0 at $DIR/indirect.rs:+1:13: +1:29 - } - - bb1: { -- _1 = move (_3.0: u8); // scope 0 at $DIR/indirect.rs:+1:13: +1:29 -+ _1 = const 3_u8; // scope 0 at $DIR/indirect.rs:+1:13: +1:29 - StorageDead(_2); // scope 0 at $DIR/indirect.rs:+1:28: +1:29 - _0 = const (); // scope 0 at $DIR/indirect.rs:+0:11: +2:2 - StorageDead(_1); // scope 0 at $DIR/indirect.rs:+2:1: +2:2 - return; // scope 0 at $DIR/indirect.rs:+2:2: +2:2 - } - } - diff --git a/src/test/mir-opt/dataflow-const-prop/previous/indirect.rs b/src/test/mir-opt/dataflow-const-prop/previous/indirect.rs deleted file mode 100644 index d8d79d29b8a..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/indirect.rs +++ /dev/null @@ -1,7 +0,0 @@ -// unit-test: DataflowConstProp -// compile-flags: -C overflow-checks=on - -// EMIT_MIR indirect.main.DataflowConstProp.diff -fn main() { - let x = (2u32 as u8) + 1; -} diff --git a/src/test/mir-opt/dataflow-const-prop/previous/invalid_constant.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/previous/invalid_constant.main.DataflowConstProp.diff deleted file mode 100644 index 9cf6c1f989c..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/invalid_constant.main.DataflowConstProp.diff +++ /dev/null @@ -1,74 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/invalid_constant.rs:+0:11: +0:11 - let _1: char; // in scope 0 at $DIR/invalid_constant.rs:+6:9: +6:22 - let mut _2: main::InvalidChar; // in scope 0 at $DIR/invalid_constant.rs:+6:34: +6:63 - let mut _4: E; // in scope 0 at $DIR/invalid_constant.rs:+13:25: +13:59 - let mut _5: main::InvalidTag; // in scope 0 at $DIR/invalid_constant.rs:+13:34: +13:55 - let mut _7: Empty; // in scope 0 at $DIR/invalid_constant.rs:+20:35: +20:73 - let mut _8: main::NoVariants; // in scope 0 at $DIR/invalid_constant.rs:+20:44: +20:65 - scope 1 { - debug _invalid_char => _1; // in scope 1 at $DIR/invalid_constant.rs:+6:9: +6:22 - let _3: [E; 1]; // in scope 1 at $DIR/invalid_constant.rs:+13:9: +13:21 - scope 3 { - debug _invalid_tag => _3; // in scope 3 at $DIR/invalid_constant.rs:+13:9: +13:21 - let _6: [Empty; 1]; // in scope 3 at $DIR/invalid_constant.rs:+20:9: +20:31 - scope 5 { - debug _enum_without_variants => _6; // in scope 5 at $DIR/invalid_constant.rs:+20:9: +20:31 - let _9: main::Str<"���">; // in scope 5 at $DIR/invalid_constant.rs:+24:9: +24:22 - scope 7 { - debug _non_utf8_str => _9; // in scope 7 at $DIR/invalid_constant.rs:+24:9: +24:22 - } - } - scope 6 { - } - } - scope 4 { - } - } - scope 2 { - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/invalid_constant.rs:+6:9: +6:22 - StorageLive(_2); // scope 2 at $DIR/invalid_constant.rs:+6:34: +6:63 - Deinit(_2); // scope 2 at $DIR/invalid_constant.rs:+6:34: +6:63 - (_2.0: u32) = const 1114113_u32; // scope 2 at $DIR/invalid_constant.rs:+6:34: +6:63 - _1 = const {transmute(0x00110001): char}; // scope 2 at $DIR/invalid_constant.rs:+6:34: +6:67 - StorageDead(_2); // scope 0 at $DIR/invalid_constant.rs:+6:69: +6:70 - StorageLive(_3); // scope 1 at $DIR/invalid_constant.rs:+13:9: +13:21 - StorageLive(_4); // scope 1 at $DIR/invalid_constant.rs:+13:25: +13:59 - StorageLive(_5); // scope 4 at $DIR/invalid_constant.rs:+13:34: +13:55 - Deinit(_5); // scope 4 at $DIR/invalid_constant.rs:+13:34: +13:55 - (_5.0: u32) = const 4_u32; // scope 4 at $DIR/invalid_constant.rs:+13:34: +13:55 - _4 = const Scalar(0x00000004): E; // scope 4 at $DIR/invalid_constant.rs:+13:34: +13:57 - // mir::Constant - // + span: $DIR/invalid_constant.rs:32:34: 32:57 - // + literal: Const { ty: E, val: Value(Scalar(0x00000004)) } - _3 = [const Scalar(0x00000004): E]; // scope 1 at $DIR/invalid_constant.rs:+13:24: +13:60 - // mir::Constant - // + span: $DIR/invalid_constant.rs:32:24: 32:60 - // + literal: Const { ty: E, val: Value(Scalar(0x00000004)) } - StorageDead(_4); // scope 1 at $DIR/invalid_constant.rs:+13:59: +13:60 - StorageDead(_5); // scope 1 at $DIR/invalid_constant.rs:+13:60: +13:61 - StorageLive(_6); // scope 3 at $DIR/invalid_constant.rs:+20:9: +20:31 - StorageLive(_7); // scope 3 at $DIR/invalid_constant.rs:+20:35: +20:73 - StorageLive(_8); // scope 6 at $DIR/invalid_constant.rs:+20:44: +20:65 - Deinit(_8); // scope 6 at $DIR/invalid_constant.rs:+20:44: +20:65 - (_8.0: u32) = const 0_u32; // scope 6 at $DIR/invalid_constant.rs:+20:44: +20:65 - nop; // scope 6 at $DIR/invalid_constant.rs:+20:44: +20:71 - nop; // scope 3 at $DIR/invalid_constant.rs:+20:34: +20:74 - StorageDead(_7); // scope 3 at $DIR/invalid_constant.rs:+20:73: +20:74 - StorageDead(_8); // scope 3 at $DIR/invalid_constant.rs:+20:74: +20:75 - StorageLive(_9); // scope 5 at $DIR/invalid_constant.rs:+24:9: +24:22 - nop; // scope 0 at $DIR/invalid_constant.rs:+0:11: +25:2 - StorageDead(_9); // scope 5 at $DIR/invalid_constant.rs:+25:1: +25:2 - StorageDead(_6); // scope 3 at $DIR/invalid_constant.rs:+25:1: +25:2 - StorageDead(_3); // scope 1 at $DIR/invalid_constant.rs:+25:1: +25:2 - StorageDead(_1); // scope 0 at $DIR/invalid_constant.rs:+25:1: +25:2 - return; // scope 0 at $DIR/invalid_constant.rs:+25:2: +25:2 - } - } - diff --git a/src/test/mir-opt/dataflow-const-prop/previous/invalid_constant.rs b/src/test/mir-opt/dataflow-const-prop/previous/invalid_constant.rs deleted file mode 100644 index 296fdcf0bc4..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/invalid_constant.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Verify that we can pretty print invalid constants. - -#![feature(adt_const_params)] -#![feature(inline_const)] -#![allow(incomplete_features)] - -#[derive(Copy, Clone)] -#[repr(u32)] -enum E { - A, - B, - C, -} - -#[derive(Copy, Clone)] -enum Empty {} - -// EMIT_MIR invalid_constant.main.DataflowConstProp.diff -fn main() { - // An invalid char. - union InvalidChar { - int: u32, - chr: char, - } - let _invalid_char = unsafe { InvalidChar { int: 0x110001 }.chr }; - - // An enum with an invalid tag. Regression test for #93688. - union InvalidTag { - int: u32, - e: E, - } - let _invalid_tag = [unsafe { InvalidTag { int: 4 }.e }]; - - // An enum without variants. Regression test for #94073. - union NoVariants { - int: u32, - empty: Empty, - } - let _enum_without_variants = [unsafe { NoVariants { int: 0 }.empty }]; - - // A non-UTF-8 string slice. Regression test for #75763 and #78520. - struct Str; - let _non_utf8_str: Str<{ unsafe { std::mem::transmute::<&[u8], &str>(&[0xC0, 0xC1, 0xF5]) } }>; -} diff --git a/src/test/mir-opt/dataflow-const-prop/previous/issue-66971.rs b/src/test/mir-opt/dataflow-const-prop/previous/issue-66971.rs deleted file mode 100644 index 39f0ace7134..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/issue-66971.rs +++ /dev/null @@ -1,18 +0,0 @@ -// unit-test: DataflowConstProp -// compile-flags: -Z mir-opt-level=3 - -// Due to a bug in propagating scalar pairs the assertion below used to fail. In the expected -// outputs below, after DataflowConstProp this is how _2 would look like with the bug: -// -// _2 = (const Scalar(0x00) : (), const 0u8); -// -// Which has the wrong type. - -fn encode(this: ((), u8, u8)) { - assert!(this.2 == 0); -} - -// EMIT_MIR issue_66971.main.DataflowConstProp.diff -fn main() { - encode(((), 0, 0)); -} diff --git a/src/test/mir-opt/dataflow-const-prop/previous/issue-67019.rs b/src/test/mir-opt/dataflow-const-prop/previous/issue-67019.rs deleted file mode 100644 index 6d8b482a543..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/issue-67019.rs +++ /dev/null @@ -1,13 +0,0 @@ -// unit-test: DataflowConstProp -// compile-flags: -Z mir-opt-level=3 - -// This used to ICE in const-prop - -fn test(this: ((u8, u8),)) { - assert!((this.0).0 == 1); -} - -// EMIT_MIR issue_67019.main.DataflowConstProp.diff -fn main() { - test(((1, 2),)); -} diff --git a/src/test/mir-opt/dataflow-const-prop/previous/issue_66971.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/previous/issue_66971.main.DataflowConstProp.diff deleted file mode 100644 index 62e94755f12..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/issue_66971.main.DataflowConstProp.diff +++ /dev/null @@ -1,33 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/issue-66971.rs:+0:11: +0:11 - let _1: (); // in scope 0 at $DIR/issue-66971.rs:+1:5: +1:23 - let mut _2: ((), u8, u8); // in scope 0 at $DIR/issue-66971.rs:+1:12: +1:22 - let mut _3: (); // in scope 0 at $DIR/issue-66971.rs:+1:13: +1:15 - - bb0: { - StorageLive(_1); // scope 0 at $DIR/issue-66971.rs:+1:5: +1:23 - StorageLive(_2); // scope 0 at $DIR/issue-66971.rs:+1:12: +1:22 - StorageLive(_3); // scope 0 at $DIR/issue-66971.rs:+1:13: +1:15 - nop; // scope 0 at $DIR/issue-66971.rs:+1:13: +1:15 - Deinit(_2); // scope 0 at $DIR/issue-66971.rs:+1:12: +1:22 - nop; // scope 0 at $DIR/issue-66971.rs:+1:12: +1:22 - (_2.1: u8) = const 0_u8; // scope 0 at $DIR/issue-66971.rs:+1:12: +1:22 - (_2.2: u8) = const 0_u8; // scope 0 at $DIR/issue-66971.rs:+1:12: +1:22 - StorageDead(_3); // scope 0 at $DIR/issue-66971.rs:+1:21: +1:22 - _1 = encode(move _2) -> bb1; // scope 0 at $DIR/issue-66971.rs:+1:5: +1:23 - // mir::Constant - // + span: $DIR/issue-66971.rs:17:5: 17:11 - // + literal: Const { ty: fn(((), u8, u8)) {encode}, val: Value() } - } - - bb1: { - StorageDead(_2); // scope 0 at $DIR/issue-66971.rs:+1:22: +1:23 - StorageDead(_1); // scope 0 at $DIR/issue-66971.rs:+1:23: +1:24 - nop; // scope 0 at $DIR/issue-66971.rs:+0:11: +2:2 - return; // scope 0 at $DIR/issue-66971.rs:+2:2: +2:2 - } - } - diff --git a/src/test/mir-opt/dataflow-const-prop/previous/issue_67019.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/previous/issue_67019.main.DataflowConstProp.diff deleted file mode 100644 index ddbbb113972..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/issue_67019.main.DataflowConstProp.diff +++ /dev/null @@ -1,33 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/issue-67019.rs:+0:11: +0:11 - let _1: (); // in scope 0 at $DIR/issue-67019.rs:+1:5: +1:20 - let mut _2: ((u8, u8),); // in scope 0 at $DIR/issue-67019.rs:+1:10: +1:19 - let mut _3: (u8, u8); // in scope 0 at $DIR/issue-67019.rs:+1:11: +1:17 - - bb0: { - StorageLive(_1); // scope 0 at $DIR/issue-67019.rs:+1:5: +1:20 - StorageLive(_2); // scope 0 at $DIR/issue-67019.rs:+1:10: +1:19 - StorageLive(_3); // scope 0 at $DIR/issue-67019.rs:+1:11: +1:17 - Deinit(_3); // scope 0 at $DIR/issue-67019.rs:+1:11: +1:17 - (_3.0: u8) = const 1_u8; // scope 0 at $DIR/issue-67019.rs:+1:11: +1:17 - (_3.1: u8) = const 2_u8; // scope 0 at $DIR/issue-67019.rs:+1:11: +1:17 - Deinit(_2); // scope 0 at $DIR/issue-67019.rs:+1:10: +1:19 - (_2.0: (u8, u8)) = const (1_u8, 2_u8); // scope 0 at $DIR/issue-67019.rs:+1:10: +1:19 - StorageDead(_3); // scope 0 at $DIR/issue-67019.rs:+1:18: +1:19 - _1 = test(move _2) -> bb1; // scope 0 at $DIR/issue-67019.rs:+1:5: +1:20 - // mir::Constant - // + span: $DIR/issue-67019.rs:12:5: 12:9 - // + literal: Const { ty: fn(((u8, u8),)) {test}, val: Value() } - } - - 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/dataflow-const-prop/previous/large_array_index.main.DataflowConstProp.32bit.diff b/src/test/mir-opt/dataflow-const-prop/previous/large_array_index.main.DataflowConstProp.32bit.diff deleted file mode 100644 index 487b2b74371..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/large_array_index.main.DataflowConstProp.32bit.diff +++ /dev/null @@ -1,35 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/large_array_index.rs:+0:11: +0:11 - let _1: u8; // in scope 0 at $DIR/large_array_index.rs:+2:9: +2:10 - let mut _2: [u8; 5000]; // in scope 0 at $DIR/large_array_index.rs:+2:17: +2:29 - let _3: usize; // in scope 0 at $DIR/large_array_index.rs:+2:30: +2:31 - let mut _4: usize; // in scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 - let mut _5: bool; // in scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 - scope 1 { - debug x => _1; // in scope 1 at $DIR/large_array_index.rs:+2:9: +2:10 - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/large_array_index.rs:+2:9: +2:10 - StorageLive(_2); // scope 0 at $DIR/large_array_index.rs:+2:17: +2:29 - _2 = [const 0_u8; 5000]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:29 - StorageLive(_3); // scope 0 at $DIR/large_array_index.rs:+2:30: +2:31 - _3 = const 2_usize; // scope 0 at $DIR/large_array_index.rs:+2:30: +2:31 - _4 = const 5000_usize; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 - _5 = const true; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 - assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> bb1; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 - } - - bb1: { - _1 = _2[_3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 - StorageDead(_3); // scope 0 at $DIR/large_array_index.rs:+2:32: +2:33 - StorageDead(_2); // scope 0 at $DIR/large_array_index.rs:+2:32: +2:33 - nop; // scope 0 at $DIR/large_array_index.rs:+0:11: +3:2 - StorageDead(_1); // scope 0 at $DIR/large_array_index.rs:+3:1: +3:2 - return; // scope 0 at $DIR/large_array_index.rs:+3:2: +3:2 - } - } - diff --git a/src/test/mir-opt/dataflow-const-prop/previous/large_array_index.main.DataflowConstProp.64bit.diff b/src/test/mir-opt/dataflow-const-prop/previous/large_array_index.main.DataflowConstProp.64bit.diff deleted file mode 100644 index 487b2b74371..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/large_array_index.main.DataflowConstProp.64bit.diff +++ /dev/null @@ -1,35 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/large_array_index.rs:+0:11: +0:11 - let _1: u8; // in scope 0 at $DIR/large_array_index.rs:+2:9: +2:10 - let mut _2: [u8; 5000]; // in scope 0 at $DIR/large_array_index.rs:+2:17: +2:29 - let _3: usize; // in scope 0 at $DIR/large_array_index.rs:+2:30: +2:31 - let mut _4: usize; // in scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 - let mut _5: bool; // in scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 - scope 1 { - debug x => _1; // in scope 1 at $DIR/large_array_index.rs:+2:9: +2:10 - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/large_array_index.rs:+2:9: +2:10 - StorageLive(_2); // scope 0 at $DIR/large_array_index.rs:+2:17: +2:29 - _2 = [const 0_u8; 5000]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:29 - StorageLive(_3); // scope 0 at $DIR/large_array_index.rs:+2:30: +2:31 - _3 = const 2_usize; // scope 0 at $DIR/large_array_index.rs:+2:30: +2:31 - _4 = const 5000_usize; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 - _5 = const true; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 - assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> bb1; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 - } - - bb1: { - _1 = _2[_3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 - StorageDead(_3); // scope 0 at $DIR/large_array_index.rs:+2:32: +2:33 - StorageDead(_2); // scope 0 at $DIR/large_array_index.rs:+2:32: +2:33 - nop; // scope 0 at $DIR/large_array_index.rs:+0:11: +3:2 - StorageDead(_1); // scope 0 at $DIR/large_array_index.rs:+3:1: +3:2 - return; // scope 0 at $DIR/large_array_index.rs:+3:2: +3:2 - } - } - diff --git a/src/test/mir-opt/dataflow-const-prop/previous/large_array_index.rs b/src/test/mir-opt/dataflow-const-prop/previous/large_array_index.rs deleted file mode 100644 index a1002401f57..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/large_array_index.rs +++ /dev/null @@ -1,7 +0,0 @@ -// EMIT_MIR_FOR_EACH_BIT_WIDTH - -// EMIT_MIR large_array_index.main.DataflowConstProp.diff -fn main() { - // check that we don't propagate this, because it's too large - let x: u8 = [0_u8; 5000][2]; -} 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 deleted file mode 100644 index a6f156fe052..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/mult_by_zero.rs +++ /dev/null @@ -1,10 +0,0 @@ -// unit-test: DataflowConstProp - -// EMIT_MIR mult_by_zero.test.DataflowConstProp.diff -fn test(x: i32) -> i32 { - x * 0 -} - -fn main() { - test(10); -} 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 deleted file mode 100644 index c225b35e192..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/mult_by_zero.test.DataflowConstProp.diff +++ /dev/null @@ -1,17 +0,0 @@ -- // MIR for `test` before DataflowConstProp -+ // MIR for `test` after DataflowConstProp - - fn test(_1: i32) -> i32 { - debug x => _1; // in scope 0 at $DIR/mult_by_zero.rs:+0:9: +0:10 - let mut _0: i32; // return place in scope 0 at $DIR/mult_by_zero.rs:+0:20: +0:23 - let mut _2: i32; // in scope 0 at $DIR/mult_by_zero.rs:+1:5: +1:6 - - bb0: { - StorageLive(_2); // scope 0 at $DIR/mult_by_zero.rs:+1:5: +1:6 - _2 = _1; // scope 0 at $DIR/mult_by_zero.rs:+1:5: +1:6 - _0 = Mul(move _2, const 0_i32); // scope 0 at $DIR/mult_by_zero.rs:+1:5: +1:10 - StorageDead(_2); // scope 0 at $DIR/mult_by_zero.rs:+1:9: +1:10 - return; // scope 0 at $DIR/mult_by_zero.rs:+2:2: +2:2 - } - } - 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 deleted file mode 100644 index 098440dbe2f..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable.main.DataflowConstProp.diff +++ /dev/null @@ -1,28 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/mutable_variable.rs:+0:11: +0:11 - let mut _1: i32; // in scope 0 at $DIR/mutable_variable.rs:+1:9: +1:14 - scope 1 { - debug x => _1; // in scope 1 at $DIR/mutable_variable.rs:+1:9: +1:14 - let _2: i32; // in scope 1 at $DIR/mutable_variable.rs:+3:9: +3:10 - scope 2 { - debug y => _2; // in scope 2 at $DIR/mutable_variable.rs:+3:9: +3:10 - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/mutable_variable.rs:+1:9: +1:14 - _1 = const 42_i32; // scope 0 at $DIR/mutable_variable.rs:+1:17: +1:19 - _1 = const 99_i32; // scope 1 at $DIR/mutable_variable.rs:+2:5: +2:11 - StorageLive(_2); // scope 1 at $DIR/mutable_variable.rs:+3:9: +3:10 -- _2 = _1; // scope 1 at $DIR/mutable_variable.rs:+3:13: +3:14 -+ _2 = const 99_i32; // scope 1 at $DIR/mutable_variable.rs:+3:13: +3:14 - _0 = const (); // scope 0 at $DIR/mutable_variable.rs:+0:11: +4:2 - StorageDead(_2); // scope 1 at $DIR/mutable_variable.rs:+4:1: +4:2 - StorageDead(_1); // scope 0 at $DIR/mutable_variable.rs:+4:1: +4:2 - return; // scope 0 at $DIR/mutable_variable.rs:+4:2: +4:2 - } - } - 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 deleted file mode 100644 index 680bcd7fc70..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable.rs +++ /dev/null @@ -1,8 +0,0 @@ -// unit-test: DataflowConstProp - -// EMIT_MIR mutable_variable.main.DataflowConstProp.diff -fn main() { - let mut x = 42; - x = 99; - let y = x; -} 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 deleted file mode 100644 index 1180dffdbad..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate.main.DataflowConstProp.diff +++ /dev/null @@ -1,29 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/mutable_variable_aggregate.rs:+0:11: +0:11 - let mut _1: (i32, i32); // in scope 0 at $DIR/mutable_variable_aggregate.rs:+1:9: +1:14 - scope 1 { - debug x => _1; // in scope 1 at $DIR/mutable_variable_aggregate.rs:+1:9: +1:14 - let _2: (i32, i32); // in scope 1 at $DIR/mutable_variable_aggregate.rs:+3:9: +3:10 - scope 2 { - debug y => _2; // in scope 2 at $DIR/mutable_variable_aggregate.rs:+3:9: +3:10 - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/mutable_variable_aggregate.rs:+1:9: +1:14 - Deinit(_1); // scope 0 at $DIR/mutable_variable_aggregate.rs:+1:17: +1:25 - (_1.0: i32) = const 42_i32; // scope 0 at $DIR/mutable_variable_aggregate.rs:+1:17: +1:25 - (_1.1: i32) = const 43_i32; // scope 0 at $DIR/mutable_variable_aggregate.rs:+1:17: +1:25 - (_1.1: i32) = const 99_i32; // scope 1 at $DIR/mutable_variable_aggregate.rs:+2:5: +2:13 - StorageLive(_2); // scope 1 at $DIR/mutable_variable_aggregate.rs:+3:9: +3:10 - _2 = _1; // scope 1 at $DIR/mutable_variable_aggregate.rs:+3:13: +3:14 - _0 = const (); // scope 0 at $DIR/mutable_variable_aggregate.rs:+0:11: +4:2 - StorageDead(_2); // scope 1 at $DIR/mutable_variable_aggregate.rs:+4:1: +4:2 - StorageDead(_1); // scope 0 at $DIR/mutable_variable_aggregate.rs:+4:1: +4:2 - return; // scope 0 at $DIR/mutable_variable_aggregate.rs:+4:2: +4:2 - } - } - 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 deleted file mode 100644 index 255236049f9..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate.rs +++ /dev/null @@ -1,8 +0,0 @@ -// unit-test: DataflowConstProp - -// EMIT_MIR mutable_variable_aggregate.main.DataflowConstProp.diff -fn main() { - let mut x = (42, 43); - x.1 = 99; - let y = x; -} 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 deleted file mode 100644 index f2788547800..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate_mut_ref.main.DataflowConstProp.diff +++ /dev/null @@ -1,36 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+0:11: +0:11 - let mut _1: (i32, i32); // in scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+1:9: +1:14 - scope 1 { - debug x => _1; // in scope 1 at $DIR/mutable_variable_aggregate_mut_ref.rs:+1:9: +1:14 - let _2: &mut (i32, i32); // in scope 1 at $DIR/mutable_variable_aggregate_mut_ref.rs:+2:9: +2:10 - scope 2 { - debug z => _2; // in scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+2:9: +2:10 - let _3: (i32, i32); // in scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:9: +4:10 - scope 3 { - debug y => _3; // in scope 3 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:9: +4:10 - } - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+1:9: +1:14 - Deinit(_1); // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+1:17: +1:25 - (_1.0: i32) = const 42_i32; // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+1:17: +1:25 - (_1.1: i32) = const 43_i32; // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+1:17: +1:25 - StorageLive(_2); // scope 1 at $DIR/mutable_variable_aggregate_mut_ref.rs:+2:9: +2:10 - _2 = &mut _1; // scope 1 at $DIR/mutable_variable_aggregate_mut_ref.rs:+2:13: +2:19 - ((*_2).1: i32) = const 99_i32; // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+3:5: +3:13 - StorageLive(_3); // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:9: +4:10 - _3 = _1; // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:13: +4:14 - _0 = const (); // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+0:11: +5:2 - StorageDead(_3); // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+5:1: +5:2 - StorageDead(_2); // scope 1 at $DIR/mutable_variable_aggregate_mut_ref.rs:+5:1: +5:2 - StorageDead(_1); // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+5:1: +5:2 - return; // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+5:2: +5:2 - } - } - 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 deleted file mode 100644 index 54b898b4ee5..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate_mut_ref.rs +++ /dev/null @@ -1,9 +0,0 @@ -// unit-test: DataflowConstProp - -// EMIT_MIR mutable_variable_aggregate_mut_ref.main.DataflowConstProp.diff -fn main() { - let mut x = (42, 43); - let z = &mut x; - z.1 = 99; - let y = x; -} 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 deleted file mode 100644 index 1f8e283f33a..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate_partial_read.main.DataflowConstProp.diff +++ /dev/null @@ -1,35 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+0:11: +0:11 - let mut _1: (i32, i32); // in scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+1:9: +1:14 - scope 1 { - debug x => _1; // in scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+1:9: +1:14 - let _2: i32; // in scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:9: +4:10 - scope 2 { - debug y => _2; // in scope 2 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:9: +4:10 - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+1:9: +1:14 - _1 = foo() -> bb1; // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+1:29: +1:34 - // mir::Constant - // + span: $DIR/mutable_variable_aggregate_partial_read.rs:5:29: 5:32 - // + literal: Const { ty: fn() -> (i32, i32) {foo}, val: Value() } - } - - bb1: { - (_1.1: i32) = const 99_i32; // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+2:5: +2:13 - (_1.0: i32) = const 42_i32; // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+3:5: +3:13 - StorageLive(_2); // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:9: +4:10 -- _2 = (_1.1: i32); // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:13: +4:16 -+ _2 = const 99_i32; // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:13: +4:16 - _0 = const (); // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+0:11: +5:2 - StorageDead(_2); // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+5:1: +5:2 - StorageDead(_1); // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+5:1: +5:2 - return; // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+5:2: +5:2 - } - } - 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 deleted file mode 100644 index 0439a520819..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_aggregate_partial_read.rs +++ /dev/null @@ -1,14 +0,0 @@ -// unit-test: DataflowConstProp - -// EMIT_MIR mutable_variable_aggregate_partial_read.main.DataflowConstProp.diff -fn main() { - let mut x: (i32, i32) = foo(); - x.1 = 99; - x.0 = 42; - let y = x.1; -} - -#[inline(never)] -fn foo() -> (i32, i32) { - unimplemented!() -} 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 deleted file mode 100644 index 9363e6b9aa1..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_no_prop.main.DataflowConstProp.diff +++ /dev/null @@ -1,48 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/mutable_variable_no_prop.rs:+0:11: +0:11 - let mut _1: u32; // in scope 0 at $DIR/mutable_variable_no_prop.rs:+1:9: +1:14 - let _2: (); // in scope 0 at $DIR/mutable_variable_no_prop.rs:+2:5: +4:6 - let mut _3: u32; // in scope 0 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19 - let mut _4: *mut u32; // in scope 0 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19 - scope 1 { - debug x => _1; // in scope 1 at $DIR/mutable_variable_no_prop.rs:+1:9: +1:14 - let _5: u32; // in scope 1 at $DIR/mutable_variable_no_prop.rs:+5:9: +5:10 - scope 2 { - } - scope 3 { - debug y => _5; // in scope 3 at $DIR/mutable_variable_no_prop.rs:+5:9: +5:10 - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/mutable_variable_no_prop.rs:+1:9: +1:14 - _1 = const 42_u32; // scope 0 at $DIR/mutable_variable_no_prop.rs:+1:17: +1:19 - StorageLive(_2); // scope 1 at $DIR/mutable_variable_no_prop.rs:+2:5: +4:6 - StorageLive(_3); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19 - StorageLive(_4); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19 - _4 = const {alloc1: *mut u32}; // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19 - // mir::Constant - // + span: $DIR/mutable_variable_no_prop.rs:9:13: 9:19 - // + literal: Const { ty: *mut u32, val: Value(Scalar(alloc1)) } - _3 = (*_4); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19 - _1 = move _3; // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:9: +3:19 - StorageDead(_3); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:18: +3:19 - StorageDead(_4); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:19: +3:20 - _2 = const (); // scope 2 at $DIR/mutable_variable_no_prop.rs:+2:5: +4:6 - StorageDead(_2); // scope 1 at $DIR/mutable_variable_no_prop.rs:+4:5: +4:6 - StorageLive(_5); // scope 1 at $DIR/mutable_variable_no_prop.rs:+5:9: +5:10 - _5 = _1; // scope 1 at $DIR/mutable_variable_no_prop.rs:+5:13: +5:14 - _0 = const (); // scope 0 at $DIR/mutable_variable_no_prop.rs:+0:11: +6:2 - StorageDead(_5); // scope 1 at $DIR/mutable_variable_no_prop.rs:+6:1: +6:2 - StorageDead(_1); // scope 0 at $DIR/mutable_variable_no_prop.rs:+6:1: +6:2 - return; // scope 0 at $DIR/mutable_variable_no_prop.rs:+6:2: +6:2 - } - } - - alloc1 (static: STATIC, size: 4, align: 4) { - 2a 00 00 00 │ *... - } - 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 deleted file mode 100644 index e4edf1475f2..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_no_prop.rs +++ /dev/null @@ -1,12 +0,0 @@ -// unit-test: DataflowConstProp - -static mut STATIC: u32 = 42; - -// EMIT_MIR mutable_variable_no_prop.main.DataflowConstProp.diff -fn main() { - let mut x = 42; - unsafe { - x = STATIC; - } - let y = x; -} 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 deleted file mode 100644 index 8d31d5533da..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_unprop_assign.main.DataflowConstProp.diff +++ /dev/null @@ -1,54 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/mutable_variable_unprop_assign.rs:+0:11: +0:11 - let _1: i32; // in scope 0 at $DIR/mutable_variable_unprop_assign.rs:+1:9: +1:10 - let mut _3: i32; // in scope 0 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12 - scope 1 { - debug a => _1; // in scope 1 at $DIR/mutable_variable_unprop_assign.rs:+1:9: +1:10 - let mut _2: (i32, i32); // in scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14 - scope 2 { - debug x => _2; // in scope 2 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14 - let _4: i32; // in scope 2 at $DIR/mutable_variable_unprop_assign.rs:+4:9: +4:10 - scope 3 { - debug y => _4; // in scope 3 at $DIR/mutable_variable_unprop_assign.rs:+4:9: +4:10 - let _5: i32; // in scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:9: +5:10 - scope 4 { - debug z => _5; // in scope 4 at $DIR/mutable_variable_unprop_assign.rs:+5:9: +5:10 - } - } - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+1:9: +1:10 - _1 = foo() -> bb1; // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+1:13: +1:18 - // mir::Constant - // + span: $DIR/mutable_variable_unprop_assign.rs:5:13: 5:16 - // + literal: Const { ty: fn() -> i32 {foo}, val: Value() } - } - - bb1: { - StorageLive(_2); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14 - Deinit(_2); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:29: +2:35 - (_2.0: i32) = const 1_i32; // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:29: +2:35 - (_2.1: i32) = const 2_i32; // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:29: +2:35 - StorageLive(_3); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12 - _3 = _1; // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12 - (_2.1: i32) = move _3; // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:5: +3:12 - StorageDead(_3); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12 - StorageLive(_4); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+4:9: +4:10 - _4 = (_2.1: i32); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+4:13: +4:16 - StorageLive(_5); // scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:9: +5:10 -- _5 = (_2.0: i32); // scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:13: +5:16 -+ _5 = const 1_i32; // scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:13: +5:16 - _0 = const (); // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+0:11: +6:2 - StorageDead(_5); // scope 3 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2 - StorageDead(_4); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2 - StorageDead(_2); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2 - StorageDead(_1); // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2 - return; // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+6:2: +6:2 - } - } - 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 deleted file mode 100644 index 942e96fee44..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/mutable_variable_unprop_assign.rs +++ /dev/null @@ -1,15 +0,0 @@ -// unit-test: DataflowConstProp - -// EMIT_MIR mutable_variable_unprop_assign.main.DataflowConstProp.diff -fn main() { - let a = foo(); - let mut x: (i32, i32) = (1, 2); - x.1 = a; - let y = x.1; - let z = x.0; // this could theoretically be allowed, but we can't handle it right now -} - -#[inline(never)] -fn foo() -> i32 { - unimplemented!() -} diff --git a/src/test/mir-opt/dataflow-const-prop/previous/optimizes_into_variable.main.DataflowConstProp.32bit.diff b/src/test/mir-opt/dataflow-const-prop/previous/optimizes_into_variable.main.DataflowConstProp.32bit.diff deleted file mode 100644 index 3b77cb6e543..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/optimizes_into_variable.main.DataflowConstProp.32bit.diff +++ /dev/null @@ -1,61 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11 - let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - let mut _2: (i32, bool); // in scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 - let mut _4: [i32; 6]; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 - let _5: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 - let mut _6: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 - let mut _7: bool; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 - let mut _9: Point; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:37 - scope 1 { - debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - let _3: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - scope 2 { - debug y => _3; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - let _8: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 - scope 3 { - debug z => _8; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 - } - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - _2 = const (4_i32, false); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 - assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> bb1; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 - } - - bb1: { - _1 = const 4_i32; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 - StorageLive(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - StorageLive(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 - _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 - StorageLive(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 - _5 = const 3_usize; // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 - _6 = const 6_usize; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 - _7 = const true; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 - assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> bb2; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 - } - - bb2: { - _3 = const 3_i32; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 - StorageDead(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35 - StorageDead(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35 - StorageLive(_8); // scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 - StorageLive(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:37 - Deinit(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:37 - (_9.0: u32) = const 12_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:37 - (_9.1: u32) = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:37 - _8 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:39 - StorageDead(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:39: +3:40 - nop; // scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +4:2 - StorageDead(_8); // scope 2 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 - StorageDead(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 - StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 - return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2 - } - } - diff --git a/src/test/mir-opt/dataflow-const-prop/previous/optimizes_into_variable.main.DataflowConstProp.64bit.diff b/src/test/mir-opt/dataflow-const-prop/previous/optimizes_into_variable.main.DataflowConstProp.64bit.diff deleted file mode 100644 index 3b77cb6e543..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/optimizes_into_variable.main.DataflowConstProp.64bit.diff +++ /dev/null @@ -1,61 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11 - let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - let mut _2: (i32, bool); // in scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 - let mut _4: [i32; 6]; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 - let _5: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 - let mut _6: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 - let mut _7: bool; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 - let mut _9: Point; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:37 - scope 1 { - debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - let _3: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - scope 2 { - debug y => _3; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - let _8: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 - scope 3 { - debug z => _8; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 - } - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - _2 = const (4_i32, false); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 - assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> bb1; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 - } - - bb1: { - _1 = const 4_i32; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 - StorageLive(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - StorageLive(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 - _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 - StorageLive(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 - _5 = const 3_usize; // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 - _6 = const 6_usize; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 - _7 = const true; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 - assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> bb2; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 - } - - bb2: { - _3 = const 3_i32; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 - StorageDead(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35 - StorageDead(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35 - StorageLive(_8); // scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 - StorageLive(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:37 - Deinit(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:37 - (_9.0: u32) = const 12_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:37 - (_9.1: u32) = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:37 - _8 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:39 - StorageDead(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:39: +3:40 - nop; // scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +4:2 - StorageDead(_8); // scope 2 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 - StorageDead(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 - StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 - return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2 - } - } - diff --git a/src/test/mir-opt/dataflow-const-prop/previous/optimizes_into_variable.main.SimplifyLocals.after.32bit.mir b/src/test/mir-opt/dataflow-const-prop/previous/optimizes_into_variable.main.SimplifyLocals.after.32bit.mir deleted file mode 100644 index 75cea8ad2ce..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/optimizes_into_variable.main.SimplifyLocals.after.32bit.mir +++ /dev/null @@ -1,27 +0,0 @@ -// MIR for `main` after SimplifyLocals - -fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11 - let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - scope 1 { - debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - let _2: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - scope 2 { - debug y => _2; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - let _3: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 - scope 3 { - debug z => _3; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 - } - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - StorageLive(_2); // scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - StorageLive(_3); // scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 - StorageDead(_3); // scope 2 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 - StorageDead(_2); // scope 1 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 - StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 - return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2 - } -} diff --git a/src/test/mir-opt/dataflow-const-prop/previous/optimizes_into_variable.main.SimplifyLocals.after.64bit.mir b/src/test/mir-opt/dataflow-const-prop/previous/optimizes_into_variable.main.SimplifyLocals.after.64bit.mir deleted file mode 100644 index 75cea8ad2ce..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/optimizes_into_variable.main.SimplifyLocals.after.64bit.mir +++ /dev/null @@ -1,27 +0,0 @@ -// MIR for `main` after SimplifyLocals - -fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11 - let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - scope 1 { - debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - let _2: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - scope 2 { - debug y => _2; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - let _3: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 - scope 3 { - debug z => _3; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 - } - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - StorageLive(_2); // scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - StorageLive(_3); // scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 - StorageDead(_3); // scope 2 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 - StorageDead(_2); // scope 1 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 - StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 - return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2 - } -} diff --git a/src/test/mir-opt/dataflow-const-prop/previous/optimizes_into_variable.rs b/src/test/mir-opt/dataflow-const-prop/previous/optimizes_into_variable.rs deleted file mode 100644 index 189a080dbef..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/optimizes_into_variable.rs +++ /dev/null @@ -1,16 +0,0 @@ -// unit-test -// compile-flags: -C overflow-checks=on - -struct Point { - x: u32, - y: u32, -} - -// EMIT_MIR_FOR_EACH_BIT_WIDTH -// EMIT_MIR optimizes_into_variable.main.DataflowConstProp.diff -// EMIT_MIR optimizes_into_variable.main.SimplifyLocals.after.mir -fn main() { - let x = 2 + 2; - let y = [0, 1, 2, 3, 4, 5][3]; - let z = (Point { x: 12, y: 42 }).y; -} 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 deleted file mode 100644 index a48ba5bf2e1..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/read_immutable_static.main.DataflowConstProp.diff +++ /dev/null @@ -1,45 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/read_immutable_static.rs:+0:11: +0:11 - let _1: u8; // in scope 0 at $DIR/read_immutable_static.rs:+1:9: +1:10 - let mut _2: u8; // in scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:16 - let mut _3: &u8; // in scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:16 - let mut _4: u8; // in scope 0 at $DIR/read_immutable_static.rs:+1:19: +1:22 - let mut _5: &u8; // in scope 0 at $DIR/read_immutable_static.rs:+1:19: +1:22 - scope 1 { - debug x => _1; // in scope 1 at $DIR/read_immutable_static.rs:+1:9: +1:10 - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/read_immutable_static.rs:+1:9: +1:10 - StorageLive(_2); // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:16 - StorageLive(_3); // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:16 - _3 = const {alloc1: &u8}; // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:16 - // mir::Constant - // + span: $DIR/read_immutable_static.rs:7:13: 7:16 - // + literal: Const { ty: &u8, val: Value(Scalar(alloc1)) } - _2 = (*_3); // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:16 - StorageLive(_4); // scope 0 at $DIR/read_immutable_static.rs:+1:19: +1:22 - StorageLive(_5); // scope 0 at $DIR/read_immutable_static.rs:+1:19: +1:22 - _5 = const {alloc1: &u8}; // scope 0 at $DIR/read_immutable_static.rs:+1:19: +1:22 - // mir::Constant - // + span: $DIR/read_immutable_static.rs:7:19: 7:22 - // + literal: Const { ty: &u8, val: Value(Scalar(alloc1)) } - _4 = (*_5); // scope 0 at $DIR/read_immutable_static.rs:+1:19: +1:22 - _1 = Add(move _2, move _4); // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:22 - StorageDead(_4); // scope 0 at $DIR/read_immutable_static.rs:+1:21: +1:22 - StorageDead(_2); // scope 0 at $DIR/read_immutable_static.rs:+1:21: +1:22 - StorageDead(_5); // scope 0 at $DIR/read_immutable_static.rs:+1:22: +1:23 - StorageDead(_3); // scope 0 at $DIR/read_immutable_static.rs:+1:22: +1:23 - _0 = const (); // scope 0 at $DIR/read_immutable_static.rs:+0:11: +2:2 - StorageDead(_1); // scope 0 at $DIR/read_immutable_static.rs:+2:1: +2:2 - return; // scope 0 at $DIR/read_immutable_static.rs:+2:2: +2:2 - } - } - - alloc1 (static: FOO, size: 1, align: 1) { - 02 │ . - } - 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 deleted file mode 100644 index 6324b4a9c54..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/read_immutable_static.rs +++ /dev/null @@ -1,8 +0,0 @@ -// unit-test: DataflowConstProp - -static FOO: u8 = 2; - -// EMIT_MIR read_immutable_static.main.DataflowConstProp.diff -fn main() { - let x = FOO + FOO; -} 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 deleted file mode 100644 index 018178ab624..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/ref_deref.main.DataflowConstProp.diff +++ /dev/null @@ -1,26 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/ref_deref.rs:+0:11: +0:11 - let _1: i32; // in scope 0 at $DIR/ref_deref.rs:+1:5: +1:10 - let mut _2: &i32; // in scope 0 at $DIR/ref_deref.rs:+1:6: +1:10 - let _3: i32; // in scope 0 at $DIR/ref_deref.rs:+1:8: +1:9 - let mut _4: &i32; // in scope 0 at $DIR/ref_deref.rs:+1:6: +1:10 - - bb0: { - StorageLive(_1); // scope 0 at $DIR/ref_deref.rs:+1:5: +1:10 - StorageLive(_2); // scope 0 at $DIR/ref_deref.rs:+1:6: +1:10 - _4 = const _; // scope 0 at $DIR/ref_deref.rs:+1:6: +1:10 - // mir::Constant - // + span: $DIR/ref_deref.rs:6:6: 6:10 - // + literal: Const { ty: &i32, val: Unevaluated(main, [], Some(promoted[0])) } - _2 = &(*_4); // scope 0 at $DIR/ref_deref.rs:+1:6: +1:10 - _1 = (*_2); // scope 0 at $DIR/ref_deref.rs:+1:5: +1:10 - StorageDead(_2); // scope 0 at $DIR/ref_deref.rs:+1:10: +1:11 - StorageDead(_1); // scope 0 at $DIR/ref_deref.rs:+1:10: +1:11 - _0 = const (); // scope 0 at $DIR/ref_deref.rs:+0:11: +2:2 - return; // scope 0 at $DIR/ref_deref.rs:+2:2: +2:2 - } - } - 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 deleted file mode 100644 index 015ec4d078c..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/ref_deref.main.PromoteTemps.diff +++ /dev/null @@ -1,30 +0,0 @@ -- // MIR for `main` before PromoteTemps -+ // MIR for `main` after PromoteTemps - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/ref_deref.rs:+0:11: +0:11 - let _1: i32; // in scope 0 at $DIR/ref_deref.rs:+1:5: +1:10 - let mut _2: &i32; // in scope 0 at $DIR/ref_deref.rs:+1:6: +1:10 - let _3: i32; // in scope 0 at $DIR/ref_deref.rs:+1:8: +1:9 -+ let mut _4: &i32; // in scope 0 at $DIR/ref_deref.rs:+1:6: +1:10 - - bb0: { - StorageLive(_1); // scope 0 at $DIR/ref_deref.rs:+1:5: +1:10 - StorageLive(_2); // scope 0 at $DIR/ref_deref.rs:+1:6: +1:10 -- StorageLive(_3); // scope 0 at $DIR/ref_deref.rs:+1:8: +1:9 -- _3 = const 4_i32; // scope 0 at $DIR/ref_deref.rs:+1:8: +1:9 -- _2 = &_3; // scope 0 at $DIR/ref_deref.rs:+1:6: +1:10 -+ _4 = const _; // scope 0 at $DIR/ref_deref.rs:+1:6: +1:10 -+ // mir::Constant -+ // + span: $DIR/ref_deref.rs:6:6: 6:10 -+ // + literal: Const { ty: &i32, val: Unevaluated(main, [], Some(promoted[0])) } -+ _2 = &(*_4); // scope 0 at $DIR/ref_deref.rs:+1:6: +1:10 - _1 = (*_2); // scope 0 at $DIR/ref_deref.rs:+1:5: +1:10 -- StorageDead(_3); // scope 0 at $DIR/ref_deref.rs:+1:10: +1:11 - StorageDead(_2); // scope 0 at $DIR/ref_deref.rs:+1:10: +1:11 - StorageDead(_1); // scope 0 at $DIR/ref_deref.rs:+1:10: +1:11 - _0 = const (); // scope 0 at $DIR/ref_deref.rs:+0:11: +2:2 - return; // scope 0 at $DIR/ref_deref.rs:+2:2: +2:2 - } - } - 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 deleted file mode 100644 index b3ec2383b91..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/ref_deref.rs +++ /dev/null @@ -1,7 +0,0 @@ -// unit-test: DataflowConstProp -// EMIT_MIR ref_deref.main.PromoteTemps.diff -// EMIT_MIR ref_deref.main.DataflowConstProp.diff - -fn main() { - *(&4); -} 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 deleted file mode 100644 index f16d2fcafb8..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/ref_deref_project.main.DataflowConstProp.diff +++ /dev/null @@ -1,26 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/ref_deref_project.rs:+0:11: +0:11 - let _1: i32; // in scope 0 at $DIR/ref_deref_project.rs:+1:5: +1:17 - let mut _2: &i32; // in scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17 - let _3: (i32, i32); // in scope 0 at $DIR/ref_deref_project.rs:+1:8: +1:14 - let mut _4: &(i32, i32); // in scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17 - - bb0: { - StorageLive(_1); // scope 0 at $DIR/ref_deref_project.rs:+1:5: +1:17 - StorageLive(_2); // scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17 - _4 = const _; // scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17 - // mir::Constant - // + span: $DIR/ref_deref_project.rs:6:6: 6:17 - // + literal: Const { ty: &(i32, i32), val: Unevaluated(main, [], Some(promoted[0])) } - _2 = &((*_4).1: i32); // scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17 - _1 = (*_2); // scope 0 at $DIR/ref_deref_project.rs:+1:5: +1:17 - StorageDead(_2); // scope 0 at $DIR/ref_deref_project.rs:+1:17: +1:18 - StorageDead(_1); // scope 0 at $DIR/ref_deref_project.rs:+1:17: +1:18 - _0 = const (); // scope 0 at $DIR/ref_deref_project.rs:+0:11: +2:2 - return; // scope 0 at $DIR/ref_deref_project.rs:+2:2: +2:2 - } - } - diff --git a/src/test/mir-opt/dataflow-const-prop/previous/ref_deref_project.main.PromoteTemps.diff b/src/test/mir-opt/dataflow-const-prop/previous/ref_deref_project.main.PromoteTemps.diff deleted file mode 100644 index cd0616e65ba..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/ref_deref_project.main.PromoteTemps.diff +++ /dev/null @@ -1,30 +0,0 @@ -- // MIR for `main` before PromoteTemps -+ // MIR for `main` after PromoteTemps - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/ref_deref_project.rs:+0:11: +0:11 - let _1: i32; // in scope 0 at $DIR/ref_deref_project.rs:+1:5: +1:17 - let mut _2: &i32; // in scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17 - let _3: (i32, i32); // in scope 0 at $DIR/ref_deref_project.rs:+1:8: +1:14 -+ let mut _4: &(i32, i32); // in scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17 - - bb0: { - StorageLive(_1); // scope 0 at $DIR/ref_deref_project.rs:+1:5: +1:17 - StorageLive(_2); // scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17 -- StorageLive(_3); // scope 0 at $DIR/ref_deref_project.rs:+1:8: +1:14 -- _3 = (const 4_i32, const 5_i32); // scope 0 at $DIR/ref_deref_project.rs:+1:8: +1:14 -- _2 = &(_3.1: i32); // scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17 -+ _4 = const _; // scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17 -+ // mir::Constant -+ // + span: $DIR/ref_deref_project.rs:6:6: 6:17 -+ // + literal: Const { ty: &(i32, i32), val: Unevaluated(main, [], Some(promoted[0])) } -+ _2 = &((*_4).1: i32); // scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17 - _1 = (*_2); // scope 0 at $DIR/ref_deref_project.rs:+1:5: +1:17 -- StorageDead(_3); // scope 0 at $DIR/ref_deref_project.rs:+1:17: +1:18 - StorageDead(_2); // scope 0 at $DIR/ref_deref_project.rs:+1:17: +1:18 - StorageDead(_1); // scope 0 at $DIR/ref_deref_project.rs:+1:17: +1:18 - _0 = const (); // scope 0 at $DIR/ref_deref_project.rs:+0:11: +2:2 - return; // scope 0 at $DIR/ref_deref_project.rs:+2:2: +2:2 - } - } - 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 deleted file mode 100644 index 65175917e13..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/ref_deref_project.rs +++ /dev/null @@ -1,7 +0,0 @@ -// unit-test: DataflowConstProp -// EMIT_MIR ref_deref_project.main.PromoteTemps.diff -// EMIT_MIR ref_deref_project.main.DataflowConstProp.diff - -fn main() { - *(&(4, 5).1); // This does not currently propagate (#67862) -} 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 deleted file mode 100644 index 6822f353b05..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/reify_fn_ptr.main.DataflowConstProp.diff +++ /dev/null @@ -1,29 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/reify_fn_ptr.rs:+0:11: +0:11 - let mut _1: *const fn(); // in scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:41 - let mut _2: usize; // in scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:26 - let mut _3: fn(); // in scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:17 - scope 1 { - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:41 - StorageLive(_2); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:26 - StorageLive(_3); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:17 - _3 = main as fn() (Pointer(ReifyFnPointer)); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:17 - // mir::Constant - // + span: $DIR/reify_fn_ptr.rs:5:13: 5:17 - // + literal: Const { ty: fn() {main}, val: Value() } - _2 = move _3 as usize (PointerExposeAddress); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:26 - StorageDead(_3); // scope 0 at $DIR/reify_fn_ptr.rs:+1:25: +1:26 - _1 = move _2 as *const fn() (PointerFromExposedAddress); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:41 - StorageDead(_2); // scope 0 at $DIR/reify_fn_ptr.rs:+1:40: +1:41 - StorageDead(_1); // scope 0 at $DIR/reify_fn_ptr.rs:+1:41: +1:42 - _0 = const (); // scope 0 at $DIR/reify_fn_ptr.rs:+0:11: +2:2 - return; // scope 0 at $DIR/reify_fn_ptr.rs:+2:2: +2:2 - } - } - 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 deleted file mode 100644 index c69680d36e2..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/reify_fn_ptr.rs +++ /dev/null @@ -1,6 +0,0 @@ -// unit-test: DataflowConstProp -// EMIT_MIR reify_fn_ptr.main.DataflowConstProp.diff - -fn main() { - let _ = main as usize as *const fn(); -} 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 deleted file mode 100644 index 4e3de9df468..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/repeat.main.DataflowConstProp.32bit.diff +++ /dev/null @@ -1,41 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/repeat.rs:+0:11: +0:11 - let _1: u32; // in scope 0 at $DIR/repeat.rs:+1:9: +1:10 - let mut _2: u32; // in scope 0 at $DIR/repeat.rs:+1:18: +1:28 - let mut _3: [u32; 8]; // in scope 0 at $DIR/repeat.rs:+1:18: +1:25 - let _4: usize; // in scope 0 at $DIR/repeat.rs:+1:26: +1:27 - let mut _5: usize; // in scope 0 at $DIR/repeat.rs:+1:18: +1:28 - let mut _6: bool; // in scope 0 at $DIR/repeat.rs:+1:18: +1:28 - scope 1 { - debug x => _1; // in scope 1 at $DIR/repeat.rs:+1:9: +1:10 - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/repeat.rs:+1:9: +1:10 - StorageLive(_2); // scope 0 at $DIR/repeat.rs:+1:18: +1:28 - StorageLive(_3); // scope 0 at $DIR/repeat.rs:+1:18: +1:25 - _3 = [const 42_u32; 8]; // scope 0 at $DIR/repeat.rs:+1:18: +1:25 - StorageLive(_4); // scope 0 at $DIR/repeat.rs:+1:26: +1:27 - _4 = const 2_usize; // scope 0 at $DIR/repeat.rs:+1:26: +1:27 - _5 = Len(_3); // scope 0 at $DIR/repeat.rs:+1:18: +1:28 -- _6 = Lt(_4, _5); // scope 0 at $DIR/repeat.rs:+1:18: +1:28 -- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> bb1; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 -+ _6 = Lt(const 2_usize, _5); // scope 0 at $DIR/repeat.rs:+1:18: +1:28 -+ assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, const 2_usize) -> bb1; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 - } - - bb1: { - _2 = _3[_4]; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 - _1 = Add(move _2, const 0_u32); // scope 0 at $DIR/repeat.rs:+1:18: +1:32 - StorageDead(_2); // scope 0 at $DIR/repeat.rs:+1:31: +1:32 - StorageDead(_4); // scope 0 at $DIR/repeat.rs:+1:32: +1:33 - StorageDead(_3); // scope 0 at $DIR/repeat.rs:+1:32: +1:33 - _0 = const (); // scope 0 at $DIR/repeat.rs:+0:11: +2:2 - StorageDead(_1); // scope 0 at $DIR/repeat.rs:+2:1: +2:2 - return; // scope 0 at $DIR/repeat.rs:+2:2: +2:2 - } - } - 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 deleted file mode 100644 index 4e3de9df468..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/repeat.main.DataflowConstProp.64bit.diff +++ /dev/null @@ -1,41 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/repeat.rs:+0:11: +0:11 - let _1: u32; // in scope 0 at $DIR/repeat.rs:+1:9: +1:10 - let mut _2: u32; // in scope 0 at $DIR/repeat.rs:+1:18: +1:28 - let mut _3: [u32; 8]; // in scope 0 at $DIR/repeat.rs:+1:18: +1:25 - let _4: usize; // in scope 0 at $DIR/repeat.rs:+1:26: +1:27 - let mut _5: usize; // in scope 0 at $DIR/repeat.rs:+1:18: +1:28 - let mut _6: bool; // in scope 0 at $DIR/repeat.rs:+1:18: +1:28 - scope 1 { - debug x => _1; // in scope 1 at $DIR/repeat.rs:+1:9: +1:10 - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/repeat.rs:+1:9: +1:10 - StorageLive(_2); // scope 0 at $DIR/repeat.rs:+1:18: +1:28 - StorageLive(_3); // scope 0 at $DIR/repeat.rs:+1:18: +1:25 - _3 = [const 42_u32; 8]; // scope 0 at $DIR/repeat.rs:+1:18: +1:25 - StorageLive(_4); // scope 0 at $DIR/repeat.rs:+1:26: +1:27 - _4 = const 2_usize; // scope 0 at $DIR/repeat.rs:+1:26: +1:27 - _5 = Len(_3); // scope 0 at $DIR/repeat.rs:+1:18: +1:28 -- _6 = Lt(_4, _5); // scope 0 at $DIR/repeat.rs:+1:18: +1:28 -- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> bb1; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 -+ _6 = Lt(const 2_usize, _5); // scope 0 at $DIR/repeat.rs:+1:18: +1:28 -+ assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, const 2_usize) -> bb1; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 - } - - bb1: { - _2 = _3[_4]; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 - _1 = Add(move _2, const 0_u32); // scope 0 at $DIR/repeat.rs:+1:18: +1:32 - StorageDead(_2); // scope 0 at $DIR/repeat.rs:+1:31: +1:32 - StorageDead(_4); // scope 0 at $DIR/repeat.rs:+1:32: +1:33 - StorageDead(_3); // scope 0 at $DIR/repeat.rs:+1:32: +1:33 - _0 = const (); // scope 0 at $DIR/repeat.rs:+0:11: +2:2 - StorageDead(_1); // scope 0 at $DIR/repeat.rs:+2:1: +2:2 - return; // scope 0 at $DIR/repeat.rs:+2:2: +2:2 - } - } - diff --git a/src/test/mir-opt/dataflow-const-prop/previous/repeat.rs b/src/test/mir-opt/dataflow-const-prop/previous/repeat.rs deleted file mode 100644 index df5284d11da..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/repeat.rs +++ /dev/null @@ -1,7 +0,0 @@ -// unit-test: DataflowConstProp - -// EMIT_MIR_FOR_EACH_BIT_WIDTH -// EMIT_MIR repeat.main.DataflowConstProp.diff -fn main() { - let x: u32 = [42; 8][2] + 0; -} 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 deleted file mode 100644 index 07cdba28e04..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/return_place.add.DataflowConstProp.diff +++ /dev/null @@ -1,20 +0,0 @@ -- // MIR for `add` before DataflowConstProp -+ // MIR for `add` after DataflowConstProp - - fn add() -> u32 { - let mut _0: u32; // return place in scope 0 at $DIR/return_place.rs:+0:13: +0:16 - let mut _1: (u32, bool); // in scope 0 at $DIR/return_place.rs:+1:5: +1:10 - - bb0: { - _1 = CheckedAdd(const 2_u32, const 2_u32); // scope 0 at $DIR/return_place.rs:+1:5: +1:10 -- assert(!move (_1.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_u32, const 2_u32) -> bb1; // scope 0 at $DIR/return_place.rs:+1:5: +1:10 -+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_u32, const 2_u32) -> bb1; // scope 0 at $DIR/return_place.rs:+1:5: +1:10 - } - - bb1: { -- _0 = move (_1.0: u32); // scope 0 at $DIR/return_place.rs:+1:5: +1:10 -+ _0 = const 4_u32; // scope 0 at $DIR/return_place.rs:+1:5: +1:10 - return; // scope 0 at $DIR/return_place.rs:+2:2: +2:2 - } - } - 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 deleted file mode 100644 index 4f5ea6320f1..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/return_place.add.PreCodegen.before.mir +++ /dev/null @@ -1,16 +0,0 @@ -// MIR for `add` before PreCodegen - -fn add() -> u32 { - let mut _0: u32; // return place in scope 0 at $DIR/return_place.rs:+0:13: +0:16 - let mut _1: (u32, bool); // in scope 0 at $DIR/return_place.rs:+1:5: +1:10 - - bb0: { - _1 = CheckedAdd(const 2_u32, const 2_u32); // scope 0 at $DIR/return_place.rs:+1:5: +1:10 - assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_u32, const 2_u32) -> bb1; // scope 0 at $DIR/return_place.rs:+1:5: +1:10 - } - - bb1: { - _0 = const 4_u32; // scope 0 at $DIR/return_place.rs:+1:5: +1:10 - return; // scope 0 at $DIR/return_place.rs:+2:2: +2:2 - } -} 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 deleted file mode 100644 index 26365cc5db2..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/return_place.rs +++ /dev/null @@ -1,12 +0,0 @@ -// unit-test: DataflowConstProp -// compile-flags: -C overflow-checks=on - -// EMIT_MIR return_place.add.DataflowConstProp.diff -// EMIT_MIR return_place.add.PreCodegen.before.mir -fn add() -> u32 { - 2 + 2 -} - -fn main() { - add(); -} 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 deleted file mode 100644 index a0212aea5dd..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/scalar_literal_propagation.main.DataflowConstProp.diff +++ /dev/null @@ -1,35 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/scalar_literal_propagation.rs:+0:11: +0:11 - let _1: u32; // in scope 0 at $DIR/scalar_literal_propagation.rs:+1:9: +1:10 - let _2: (); // in scope 0 at $DIR/scalar_literal_propagation.rs:+2:5: +2:15 - let mut _3: u32; // in scope 0 at $DIR/scalar_literal_propagation.rs:+2:13: +2:14 - scope 1 { - debug x => _1; // in scope 1 at $DIR/scalar_literal_propagation.rs:+1:9: +1:10 - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/scalar_literal_propagation.rs:+1:9: +1:10 - _1 = const 1_u32; // scope 0 at $DIR/scalar_literal_propagation.rs:+1:13: +1:14 - StorageLive(_2); // scope 1 at $DIR/scalar_literal_propagation.rs:+2:5: +2:15 - StorageLive(_3); // scope 1 at $DIR/scalar_literal_propagation.rs:+2:13: +2:14 -- _3 = _1; // scope 1 at $DIR/scalar_literal_propagation.rs:+2:13: +2:14 -- _2 = consume(move _3) -> bb1; // scope 1 at $DIR/scalar_literal_propagation.rs:+2:5: +2:15 -+ _3 = const 1_u32; // scope 1 at $DIR/scalar_literal_propagation.rs:+2:13: +2:14 -+ _2 = consume(const 1_u32) -> bb1; // scope 1 at $DIR/scalar_literal_propagation.rs:+2:5: +2:15 - // mir::Constant - // + span: $DIR/scalar_literal_propagation.rs:5:5: 5:12 - // + literal: Const { ty: fn(u32) {consume}, val: Value() } - } - - bb1: { - StorageDead(_3); // scope 1 at $DIR/scalar_literal_propagation.rs:+2:14: +2:15 - StorageDead(_2); // scope 1 at $DIR/scalar_literal_propagation.rs:+2:15: +2:16 - _0 = const (); // scope 0 at $DIR/scalar_literal_propagation.rs:+0:11: +3:2 - StorageDead(_1); // scope 0 at $DIR/scalar_literal_propagation.rs:+3:1: +3:2 - return; // scope 0 at $DIR/scalar_literal_propagation.rs:+3:2: +3:2 - } - } - 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 deleted file mode 100644 index d26cb30c076..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/scalar_literal_propagation.rs +++ /dev/null @@ -1,9 +0,0 @@ -// unit-test: DataflowConstProp -// EMIT_MIR scalar_literal_propagation.main.DataflowConstProp.diff -fn main() { - let x = 1; - consume(x); -} - -#[inline(never)] -fn consume(_: u32) {} 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 deleted file mode 100644 index e39afae5aa6..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/slice_len.main.DataflowConstProp.32bit.diff +++ /dev/null @@ -1,48 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/slice_len.rs:+0:11: +0:11 - let _1: u32; // in scope 0 at $DIR/slice_len.rs:+1:5: +1:33 - let mut _2: &[u32]; // in scope 0 at $DIR/slice_len.rs:+1:5: +1:30 - let mut _3: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:+1:6: +1:19 - let _4: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:+1:6: +1:19 - let _5: [u32; 3]; // in scope 0 at $DIR/slice_len.rs:+1:7: +1:19 - let _6: usize; // in scope 0 at $DIR/slice_len.rs:+1:31: +1:32 - let mut _7: usize; // in scope 0 at $DIR/slice_len.rs:+1:5: +1:33 - let mut _8: bool; // in scope 0 at $DIR/slice_len.rs:+1:5: +1:33 - let mut _9: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:+1:6: +1:19 - - bb0: { - StorageLive(_1); // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 - StorageLive(_2); // scope 0 at $DIR/slice_len.rs:+1:5: +1:30 - StorageLive(_3); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 - StorageLive(_4); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 - _9 = const _; // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 - // mir::Constant - // + span: $DIR/slice_len.rs:6:6: 6:19 - // + literal: Const { ty: &[u32; 3], val: Unevaluated(main, [], Some(promoted[0])) } - _4 = &(*_9); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 - _3 = &(*_4); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 - _2 = move _3 as &[u32] (Pointer(Unsize)); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 - StorageDead(_3); // scope 0 at $DIR/slice_len.rs:+1:18: +1:19 - StorageLive(_6); // scope 0 at $DIR/slice_len.rs:+1:31: +1:32 - _6 = const 1_usize; // scope 0 at $DIR/slice_len.rs:+1:31: +1:32 - _7 = Len((*_2)); // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 -- _8 = Lt(_6, _7); // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 -- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 -+ _8 = Lt(const 1_usize, _7); // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 -+ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 1_usize) -> bb1; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 - } - - bb1: { - _1 = (*_2)[_6]; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 - StorageDead(_6); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34 - StorageDead(_4); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34 - StorageDead(_2); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34 - StorageDead(_1); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34 - _0 = const (); // scope 0 at $DIR/slice_len.rs:+0:11: +2:2 - return; // scope 0 at $DIR/slice_len.rs:+2:2: +2:2 - } - } - 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 deleted file mode 100644 index e39afae5aa6..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/slice_len.main.DataflowConstProp.64bit.diff +++ /dev/null @@ -1,48 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/slice_len.rs:+0:11: +0:11 - let _1: u32; // in scope 0 at $DIR/slice_len.rs:+1:5: +1:33 - let mut _2: &[u32]; // in scope 0 at $DIR/slice_len.rs:+1:5: +1:30 - let mut _3: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:+1:6: +1:19 - let _4: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:+1:6: +1:19 - let _5: [u32; 3]; // in scope 0 at $DIR/slice_len.rs:+1:7: +1:19 - let _6: usize; // in scope 0 at $DIR/slice_len.rs:+1:31: +1:32 - let mut _7: usize; // in scope 0 at $DIR/slice_len.rs:+1:5: +1:33 - let mut _8: bool; // in scope 0 at $DIR/slice_len.rs:+1:5: +1:33 - let mut _9: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:+1:6: +1:19 - - bb0: { - StorageLive(_1); // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 - StorageLive(_2); // scope 0 at $DIR/slice_len.rs:+1:5: +1:30 - StorageLive(_3); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 - StorageLive(_4); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 - _9 = const _; // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 - // mir::Constant - // + span: $DIR/slice_len.rs:6:6: 6:19 - // + literal: Const { ty: &[u32; 3], val: Unevaluated(main, [], Some(promoted[0])) } - _4 = &(*_9); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 - _3 = &(*_4); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 - _2 = move _3 as &[u32] (Pointer(Unsize)); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 - StorageDead(_3); // scope 0 at $DIR/slice_len.rs:+1:18: +1:19 - StorageLive(_6); // scope 0 at $DIR/slice_len.rs:+1:31: +1:32 - _6 = const 1_usize; // scope 0 at $DIR/slice_len.rs:+1:31: +1:32 - _7 = Len((*_2)); // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 -- _8 = Lt(_6, _7); // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 -- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 -+ _8 = Lt(const 1_usize, _7); // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 -+ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 1_usize) -> bb1; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 - } - - bb1: { - _1 = (*_2)[_6]; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 - StorageDead(_6); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34 - StorageDead(_4); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34 - StorageDead(_2); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34 - StorageDead(_1); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34 - _0 = const (); // scope 0 at $DIR/slice_len.rs:+0:11: +2:2 - return; // scope 0 at $DIR/slice_len.rs:+2:2: +2:2 - } - } - 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 deleted file mode 100644 index b22d33795ef..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/slice_len.rs +++ /dev/null @@ -1,7 +0,0 @@ -// unit-test: DataflowConstProp -// EMIT_MIR_FOR_EACH_BIT_WIDTH - -// EMIT_MIR slice_len.main.DataflowConstProp.diff -fn main() { - (&[1u32, 2, 3] as &[u32])[1]; -} diff --git a/src/test/mir-opt/dataflow-const-prop/previous/switch_int.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/previous/switch_int.main.DataflowConstProp.diff deleted file mode 100644 index b2f98061d22..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/switch_int.main.DataflowConstProp.diff +++ /dev/null @@ -1,33 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/switch_int.rs:+0:11: +0:11 - let mut _1: i32; // in scope 0 at $DIR/switch_int.rs:+1:11: +1:12 - - bb0: { - StorageLive(_1); // scope 0 at $DIR/switch_int.rs:+1:11: +1:12 - _1 = const 1_i32; // scope 0 at $DIR/switch_int.rs:+1:11: +1:12 - switchInt(const 1_i32) -> [1_i32: bb2, otherwise: bb1]; // scope 0 at $DIR/switch_int.rs:+1:5: +1:12 - } - - bb1: { - _0 = foo(const -1_i32) -> bb3; // scope 0 at $DIR/switch_int.rs:+3:14: +3:21 - // mir::Constant - // + span: $DIR/switch_int.rs:9:14: 9:17 - // + literal: Const { ty: fn(i32) {foo}, val: Value() } - } - - bb2: { - _0 = foo(const 0_i32) -> bb3; // scope 0 at $DIR/switch_int.rs:+2:14: +2:20 - // mir::Constant - // + span: $DIR/switch_int.rs:8:14: 8:17 - // + literal: Const { ty: fn(i32) {foo}, val: Value() } - } - - bb3: { - StorageDead(_1); // scope 0 at $DIR/switch_int.rs:+5:1: +5:2 - return; // scope 0 at $DIR/switch_int.rs:+5:2: +5:2 - } - } - diff --git a/src/test/mir-opt/dataflow-const-prop/previous/switch_int.main.SimplifyConstCondition-after-const-prop.diff b/src/test/mir-opt/dataflow-const-prop/previous/switch_int.main.SimplifyConstCondition-after-const-prop.diff deleted file mode 100644 index 74f9eafe420..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/switch_int.main.SimplifyConstCondition-after-const-prop.diff +++ /dev/null @@ -1,34 +0,0 @@ -- // MIR for `main` before SimplifyConstCondition-after-const-prop -+ // MIR for `main` after SimplifyConstCondition-after-const-prop - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/switch_int.rs:+0:11: +0:11 - let mut _1: i32; // in scope 0 at $DIR/switch_int.rs:+1:11: +1:12 - - bb0: { - StorageLive(_1); // scope 0 at $DIR/switch_int.rs:+1:11: +1:12 - _1 = const 1_i32; // scope 0 at $DIR/switch_int.rs:+1:11: +1:12 -- switchInt(const 1_i32) -> [1_i32: bb2, otherwise: bb1]; // scope 0 at $DIR/switch_int.rs:+1:5: +1:12 -+ goto -> bb2; // scope 0 at $DIR/switch_int.rs:+1:5: +1:12 - } - - bb1: { - _0 = foo(const -1_i32) -> bb3; // scope 0 at $DIR/switch_int.rs:+3:14: +3:21 - // mir::Constant - // + span: $DIR/switch_int.rs:9:14: 9:17 - // + literal: Const { ty: fn(i32) {foo}, val: Value() } - } - - bb2: { - _0 = foo(const 0_i32) -> bb3; // scope 0 at $DIR/switch_int.rs:+2:14: +2:20 - // mir::Constant - // + span: $DIR/switch_int.rs:8:14: 8:17 - // + literal: Const { ty: fn(i32) {foo}, val: Value() } - } - - bb3: { - StorageDead(_1); // scope 0 at $DIR/switch_int.rs:+5:1: +5:2 - return; // scope 0 at $DIR/switch_int.rs:+5:2: +5:2 - } - } - diff --git a/src/test/mir-opt/dataflow-const-prop/previous/switch_int.rs b/src/test/mir-opt/dataflow-const-prop/previous/switch_int.rs deleted file mode 100644 index eec51c5c48c..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/switch_int.rs +++ /dev/null @@ -1,11 +0,0 @@ -#[inline(never)] -fn foo(_: i32) {} - -// EMIT_MIR switch_int.main.DataflowConstProp.diff -// EMIT_MIR switch_int.main.SimplifyConstCondition-after-const-prop.diff -fn main() { - match 1 { - 1 => foo(0), - _ => foo(-1), - } -} 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 deleted file mode 100644 index 3a1b5f374f0..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/tuple_literal_propagation.main.DataflowConstProp.diff +++ /dev/null @@ -1,35 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/tuple_literal_propagation.rs:+0:11: +0:11 - let _1: (u32, u32); // in scope 0 at $DIR/tuple_literal_propagation.rs:+1:9: +1:10 - let _2: (); // in scope 0 at $DIR/tuple_literal_propagation.rs:+3:5: +3:15 - let mut _3: (u32, u32); // in scope 0 at $DIR/tuple_literal_propagation.rs:+3:13: +3:14 - scope 1 { - debug x => _1; // in scope 1 at $DIR/tuple_literal_propagation.rs:+1:9: +1:10 - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/tuple_literal_propagation.rs:+1:9: +1:10 - Deinit(_1); // scope 0 at $DIR/tuple_literal_propagation.rs:+1:13: +1:19 - (_1.0: u32) = const 1_u32; // scope 0 at $DIR/tuple_literal_propagation.rs:+1:13: +1:19 - (_1.1: u32) = const 2_u32; // scope 0 at $DIR/tuple_literal_propagation.rs:+1:13: +1:19 - StorageLive(_2); // scope 1 at $DIR/tuple_literal_propagation.rs:+3:5: +3:15 - StorageLive(_3); // scope 1 at $DIR/tuple_literal_propagation.rs:+3:13: +3:14 - _3 = _1; // scope 1 at $DIR/tuple_literal_propagation.rs:+3:13: +3:14 - _2 = consume(move _3) -> bb1; // scope 1 at $DIR/tuple_literal_propagation.rs:+3:5: +3:15 - // mir::Constant - // + span: $DIR/tuple_literal_propagation.rs:6:5: 6:12 - // + literal: Const { ty: fn((u32, u32)) {consume}, val: Value() } - } - - bb1: { - StorageDead(_3); // scope 1 at $DIR/tuple_literal_propagation.rs:+3:14: +3:15 - StorageDead(_2); // scope 1 at $DIR/tuple_literal_propagation.rs:+3:15: +3:16 - _0 = const (); // scope 0 at $DIR/tuple_literal_propagation.rs:+0:11: +4:2 - StorageDead(_1); // scope 0 at $DIR/tuple_literal_propagation.rs:+4:1: +4:2 - return; // scope 0 at $DIR/tuple_literal_propagation.rs:+4:2: +4:2 - } - } - 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 deleted file mode 100644 index 737f39673a3..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/previous/tuple_literal_propagation.rs +++ /dev/null @@ -1,10 +0,0 @@ -// unit-test: DataflowConstProp -// EMIT_MIR tuple_literal_propagation.main.DataflowConstProp.diff -fn main() { - let x = (1, 2); - - consume(x); -} - -#[inline(never)] -fn consume(_: (u32, u32)) {} diff --git a/src/test/mir-opt/dataflow-const-prop/promoted.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/promoted.main.DataflowConstProp.diff index 1dabb0ae3ee..177736d62cd 100644 --- a/src/test/mir-opt/dataflow-const-prop/promoted.main.DataflowConstProp.diff +++ b/src/test/mir-opt/dataflow-const-prop/promoted.main.DataflowConstProp.diff @@ -16,7 +16,7 @@ StorageLive(_2); // scope 0 at $DIR/promoted.rs:+2:14: +2:17 _4 = const _; // scope 0 at $DIR/promoted.rs:+2:14: +2:17 // mir::Constant - // + span: $DIR/promoted.rs:6:14: 6:17 + // + span: $DIR/promoted.rs:7:14: 7:17 // + literal: Const { ty: &i32, val: Unevaluated(main, [], Some(promoted[0])) } _2 = &(*_4); // scope 0 at $DIR/promoted.rs:+2:14: +2:17 _1 = (*_2); // scope 0 at $DIR/promoted.rs:+2:13: +2:17 diff --git a/src/test/mir-opt/dataflow-const-prop/promoted.rs b/src/test/mir-opt/dataflow-const-prop/promoted.rs index 1653cf33344..e5ca2f5b607 100644 --- a/src/test/mir-opt/dataflow-const-prop/promoted.rs +++ b/src/test/mir-opt/dataflow-const-prop/promoted.rs @@ -1,4 +1,5 @@ // unit-test: DataflowConstProp +// compile-flags: -Zunsound-mir-opts // EMIT_MIR promoted.main.DataflowConstProp.diff fn main() { diff --git a/src/test/mir-opt/dataflow-const-prop/recursive.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/recursive.main.DataflowConstProp.diff deleted file mode 100644 index c344de76b6a..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/recursive.main.DataflowConstProp.diff +++ /dev/null @@ -1,132 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/recursive.rs:+0:11: +0:11 - let _1: S<'_>; // in scope 0 at $DIR/recursive.rs:+2:9: +2:10 - let mut _3: &S<'_>; // in scope 0 at $DIR/recursive.rs:+3:20: +3:22 - let _4: &S<'_>; // in scope 0 at $DIR/recursive.rs:+3:20: +3:22 - let mut _6: &S<'_>; // in scope 0 at $DIR/recursive.rs:+4:20: +4:22 - let _7: &S<'_>; // in scope 0 at $DIR/recursive.rs:+4:20: +4:22 - let mut _9: isize; // in scope 0 at $DIR/recursive.rs:+6:9: +6:18 - let mut _11: isize; // in scope 0 at $DIR/recursive.rs:+7:13: +7:22 - let mut _13: isize; // in scope 0 at $DIR/recursive.rs:+8:17: +8:28 - let mut _15: !; // in scope 0 at $DIR/recursive.rs:+9:22: +9:43 - let mut _16: !; // in scope 0 at $DIR/recursive.rs:+11:18: +11:39 - let mut _17: !; // in scope 0 at $DIR/recursive.rs:+13:14: +13:35 - let mut _18: &S<'_>; // in scope 0 at $DIR/recursive.rs:+7:20: +7:21 - let mut _19: &S<'_>; // in scope 0 at $DIR/recursive.rs:+7:20: +7:21 - scope 1 { - debug a => _1; // in scope 1 at $DIR/recursive.rs:+2:9: +2:10 - let _2: S<'_>; // in scope 1 at $DIR/recursive.rs:+3:9: +3:10 - scope 2 { - debug b => _2; // in scope 2 at $DIR/recursive.rs:+3:9: +3:10 - let _5: S<'_>; // in scope 2 at $DIR/recursive.rs:+4:9: +4:10 - scope 3 { - debug c => _5; // in scope 3 at $DIR/recursive.rs:+4:9: +4:10 - let _8: u32; // in scope 3 at $DIR/recursive.rs:+5:9: +5:10 - let _10: &S<'_>; // in scope 3 at $DIR/recursive.rs:+6:16: +6:17 - scope 4 { - debug d => _8; // in scope 4 at $DIR/recursive.rs:+5:9: +5:10 - } - scope 5 { - debug b => _10; // in scope 5 at $DIR/recursive.rs:+6:16: +6:17 - let _12: &&S<'_>; // in scope 5 at $DIR/recursive.rs:+7:20: +7:21 - scope 6 { - debug a => _12; // in scope 6 at $DIR/recursive.rs:+7:20: +7:21 - let _14: &u32; // in scope 6 at $DIR/recursive.rs:+8:24: +8:27 - scope 7 { - debug num => _14; // in scope 7 at $DIR/recursive.rs:+8:24: +8:27 - } - } - } - } - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/recursive.rs:+2:9: +2:10 - Deinit(_1); // scope 0 at $DIR/recursive.rs:+2:13: +2:22 - ((_1 as Num).0: u32) = const 0_u32; // scope 0 at $DIR/recursive.rs:+2:13: +2:22 - discriminant(_1) = 1; // scope 0 at $DIR/recursive.rs:+2:13: +2:22 - StorageLive(_2); // scope 1 at $DIR/recursive.rs:+3:9: +3:10 - StorageLive(_3); // scope 1 at $DIR/recursive.rs:+3:20: +3:22 - StorageLive(_4); // scope 1 at $DIR/recursive.rs:+3:20: +3:22 - _4 = &_1; // scope 1 at $DIR/recursive.rs:+3:20: +3:22 - _3 = &(*_4); // scope 1 at $DIR/recursive.rs:+3:20: +3:22 - Deinit(_2); // scope 1 at $DIR/recursive.rs:+3:13: +3:23 - ((_2 as Rec).0: &S<'_>) = move _3; // scope 1 at $DIR/recursive.rs:+3:13: +3:23 - discriminant(_2) = 0; // scope 1 at $DIR/recursive.rs:+3:13: +3:23 - StorageDead(_3); // scope 1 at $DIR/recursive.rs:+3:22: +3:23 - StorageDead(_4); // scope 1 at $DIR/recursive.rs:+3:23: +3:24 - StorageLive(_5); // scope 2 at $DIR/recursive.rs:+4:9: +4:10 - StorageLive(_6); // scope 2 at $DIR/recursive.rs:+4:20: +4:22 - StorageLive(_7); // scope 2 at $DIR/recursive.rs:+4:20: +4:22 - _7 = &_2; // scope 2 at $DIR/recursive.rs:+4:20: +4:22 - _6 = &(*_7); // scope 2 at $DIR/recursive.rs:+4:20: +4:22 - Deinit(_5); // scope 2 at $DIR/recursive.rs:+4:13: +4:23 - ((_5 as Rec).0: &S<'_>) = move _6; // scope 2 at $DIR/recursive.rs:+4:13: +4:23 - discriminant(_5) = 0; // scope 2 at $DIR/recursive.rs:+4:13: +4:23 - StorageDead(_6); // scope 2 at $DIR/recursive.rs:+4:22: +4:23 - StorageDead(_7); // scope 2 at $DIR/recursive.rs:+4:23: +4:24 - StorageLive(_8); // scope 3 at $DIR/recursive.rs:+5:9: +5:10 - _9 = discriminant(_5); // scope 3 at $DIR/recursive.rs:+5:19: +5:20 - switchInt(move _9) -> [0_isize: bb2, otherwise: bb1]; // scope 3 at $DIR/recursive.rs:+5:13: +5:20 - } - - bb1: { - StorageLive(_17); // scope 3 at $DIR/recursive.rs:+13:14: +13:35 - _17 = exit(const 0_i32); // scope 3 at $DIR/recursive.rs:+13:14: +13:35 - // mir::Constant - // + span: $DIR/recursive.rs:22:14: 22:32 - // + literal: Const { ty: fn(i32) -> ! {exit}, val: Value() } - } - - bb2: { - StorageLive(_10); // scope 3 at $DIR/recursive.rs:+6:16: +6:17 - _10 = ((_5 as Rec).0: &S<'_>); // scope 3 at $DIR/recursive.rs:+6:16: +6:17 - _11 = discriminant((*_10)); // scope 5 at $DIR/recursive.rs:+6:28: +6:29 - switchInt(move _11) -> [0_isize: bb4, otherwise: bb3]; // scope 5 at $DIR/recursive.rs:+6:22: +6:29 - } - - bb3: { - StorageLive(_16); // scope 5 at $DIR/recursive.rs:+11:18: +11:39 - _16 = exit(const 0_i32); // scope 5 at $DIR/recursive.rs:+11:18: +11:39 - // mir::Constant - // + span: $DIR/recursive.rs:20:18: 20:36 - // + literal: Const { ty: fn(i32) -> ! {exit}, val: Value() } - } - - bb4: { - StorageLive(_12); // scope 5 at $DIR/recursive.rs:+7:20: +7:21 - _12 = &(((*_10) as Rec).0: &S<'_>); // scope 5 at $DIR/recursive.rs:+7:20: +7:21 - _18 = deref_copy (*_12); // scope 6 at $DIR/recursive.rs:+7:32: +7:33 - _13 = discriminant((*_18)); // scope 6 at $DIR/recursive.rs:+7:32: +7:33 - switchInt(move _13) -> [1_isize: bb6, otherwise: bb5]; // scope 6 at $DIR/recursive.rs:+7:26: +7:33 - } - - bb5: { - StorageLive(_15); // scope 6 at $DIR/recursive.rs:+9:22: +9:43 - _15 = exit(const 0_i32); // scope 6 at $DIR/recursive.rs:+9:22: +9:43 - // mir::Constant - // + span: $DIR/recursive.rs:18:22: 18:40 - // + literal: Const { ty: fn(i32) -> ! {exit}, val: Value() } - } - - bb6: { - StorageLive(_14); // scope 6 at $DIR/recursive.rs:+8:24: +8:27 - _19 = deref_copy (*_12); // scope 6 at $DIR/recursive.rs:+8:24: +8:27 - _14 = &(((*_19) as Num).0: u32); // scope 6 at $DIR/recursive.rs:+8:24: +8:27 - _8 = (*_14); // scope 7 at $DIR/recursive.rs:+8:32: +8:36 - StorageDead(_14); // scope 6 at $DIR/recursive.rs:+8:35: +8:36 - StorageDead(_12); // scope 5 at $DIR/recursive.rs:+10:13: +10:14 - StorageDead(_10); // scope 3 at $DIR/recursive.rs:+12:9: +12:10 - _0 = const (); // scope 0 at $DIR/recursive.rs:+0:11: +15:2 - StorageDead(_8); // scope 3 at $DIR/recursive.rs:+15:1: +15:2 - StorageDead(_5); // scope 2 at $DIR/recursive.rs:+15:1: +15:2 - StorageDead(_2); // scope 1 at $DIR/recursive.rs:+15:1: +15:2 - StorageDead(_1); // scope 0 at $DIR/recursive.rs:+15:1: +15:2 - return; // scope 0 at $DIR/recursive.rs:+15:2: +15:2 - } - } - diff --git a/src/test/mir-opt/dataflow-const-prop/recursive.rs b/src/test/mir-opt/dataflow-const-prop/recursive.rs deleted file mode 100644 index d7ca182b9fc..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/recursive.rs +++ /dev/null @@ -1,24 +0,0 @@ -// unit-test: DataflowConstProp - -enum S<'a> { - Rec(&'a S<'a>), - Num(u32), -} - -// EMIT_MIR recursive.main.DataflowConstProp.diff -fn main() { - // FIXME: This currently does not work, because downcasts are rejected. - let a = S::Num(0); - let b = S::Rec(&a); - let c = S::Rec(&b); - let d = match c { - S::Rec(b) => match b { - S::Rec(a) => match a { - S::Num(num) => *num, - _ => std::process::exit(0), - }, - _ => std::process::exit(0), - }, - _ => std::process::exit(0), - }; -} diff --git a/src/test/mir-opt/dataflow-const-prop/ref_mut.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/ref_mut.main.DataflowConstProp.diff index 6d55092747a..746082eee53 100644 --- a/src/test/mir-opt/dataflow-const-prop/ref_mut.main.DataflowConstProp.diff +++ b/src/test/mir-opt/dataflow-const-prop/ref_mut.main.DataflowConstProp.diff @@ -54,7 +54,7 @@ StorageLive(_8); // scope 6 at $DIR/ref_mut.rs:+9:10: +9:12 _11 = const _; // scope 6 at $DIR/ref_mut.rs:+9:10: +9:12 // mir::Constant - // + span: $DIR/ref_mut.rs:13:10: 13:12 + // + span: $DIR/ref_mut.rs:14:10: 14:12 // + literal: Const { ty: &i32, val: Unevaluated(main, [], Some(promoted[0])) } _8 = &(*_11); // scope 6 at $DIR/ref_mut.rs:+9:10: +9:12 _7 = &(*_8); // scope 6 at $DIR/ref_mut.rs:+9:10: +9:12 diff --git a/src/test/mir-opt/dataflow-const-prop/ref_mut.rs b/src/test/mir-opt/dataflow-const-prop/ref_mut.rs index 8b2baf7676d..57283439516 100644 --- a/src/test/mir-opt/dataflow-const-prop/ref_mut.rs +++ b/src/test/mir-opt/dataflow-const-prop/ref_mut.rs @@ -1,4 +1,5 @@ // unit-test: DataflowConstProp +// compile-flags: -Zunsound-mir-opts // EMIT_MIR ref_mut.main.DataflowConstProp.diff fn main() { diff --git a/src/test/mir-opt/dataflow-const-prop/self_assign.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/self_assign.main.DataflowConstProp.diff new file mode 100644 index 00000000000..dd1242d7cac --- /dev/null +++ b/src/test/mir-opt/dataflow-const-prop/self_assign.main.DataflowConstProp.diff @@ -0,0 +1,52 @@ +- // MIR for `main` before DataflowConstProp ++ // MIR for `main` after DataflowConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/self_assign.rs:+0:11: +0:11 + let mut _1: i32; // in scope 0 at $DIR/self_assign.rs:+1:9: +1:14 + let mut _2: i32; // in scope 0 at $DIR/self_assign.rs:+2:9: +2:10 + let mut _3: i32; // in scope 0 at $DIR/self_assign.rs:+3:9: +3:10 + let mut _5: &i32; // in scope 0 at $DIR/self_assign.rs:+6:9: +6:10 + let mut _6: i32; // in scope 0 at $DIR/self_assign.rs:+7:9: +7:11 + scope 1 { + debug a => _1; // in scope 1 at $DIR/self_assign.rs:+1:9: +1:14 + let mut _4: &i32; // in scope 1 at $DIR/self_assign.rs:+5:9: +5:14 + scope 2 { + debug b => _4; // in scope 2 at $DIR/self_assign.rs:+5:9: +5:14 + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/self_assign.rs:+1:9: +1:14 + _1 = const 0_i32; // scope 0 at $DIR/self_assign.rs:+1:17: +1:18 + StorageLive(_2); // scope 1 at $DIR/self_assign.rs:+2:9: +2:10 +- _2 = _1; // scope 1 at $DIR/self_assign.rs:+2:9: +2:10 +- _1 = Add(move _2, const 1_i32); // scope 1 at $DIR/self_assign.rs:+2:5: +2:14 ++ _2 = const 0_i32; // scope 1 at $DIR/self_assign.rs:+2:9: +2:10 ++ _1 = const 1_i32; // scope 1 at $DIR/self_assign.rs:+2:5: +2:14 + StorageDead(_2); // scope 1 at $DIR/self_assign.rs:+2:13: +2:14 + StorageLive(_3); // scope 1 at $DIR/self_assign.rs:+3:9: +3:10 +- _3 = _1; // scope 1 at $DIR/self_assign.rs:+3:9: +3:10 +- _1 = move _3; // scope 1 at $DIR/self_assign.rs:+3:5: +3:10 ++ _3 = const 1_i32; // scope 1 at $DIR/self_assign.rs:+3:9: +3:10 ++ _1 = const 1_i32; // scope 1 at $DIR/self_assign.rs:+3:5: +3:10 + StorageDead(_3); // scope 1 at $DIR/self_assign.rs:+3:9: +3:10 + StorageLive(_4); // scope 1 at $DIR/self_assign.rs:+5:9: +5:14 + _4 = &_1; // scope 1 at $DIR/self_assign.rs:+5:17: +5:19 + StorageLive(_5); // scope 2 at $DIR/self_assign.rs:+6:9: +6:10 + _5 = _4; // scope 2 at $DIR/self_assign.rs:+6:9: +6:10 + _4 = move _5; // scope 2 at $DIR/self_assign.rs:+6:5: +6:10 + StorageDead(_5); // scope 2 at $DIR/self_assign.rs:+6:9: +6:10 + StorageLive(_6); // scope 2 at $DIR/self_assign.rs:+7:9: +7:11 +- _6 = (*_4); // scope 2 at $DIR/self_assign.rs:+7:9: +7:11 +- _1 = move _6; // scope 2 at $DIR/self_assign.rs:+7:5: +7:11 ++ _6 = const 1_i32; // scope 2 at $DIR/self_assign.rs:+7:9: +7:11 ++ _1 = const 1_i32; // scope 2 at $DIR/self_assign.rs:+7:5: +7:11 + StorageDead(_6); // scope 2 at $DIR/self_assign.rs:+7:10: +7:11 + _0 = const (); // scope 0 at $DIR/self_assign.rs:+0:11: +8:2 + StorageDead(_4); // scope 1 at $DIR/self_assign.rs:+8:1: +8:2 + StorageDead(_1); // scope 0 at $DIR/self_assign.rs:+8:1: +8:2 + return; // scope 0 at $DIR/self_assign.rs:+8:2: +8:2 + } + } + diff --git a/src/test/mir-opt/dataflow-const-prop/self_assign.rs b/src/test/mir-opt/dataflow-const-prop/self_assign.rs new file mode 100644 index 00000000000..e8a62a83960 --- /dev/null +++ b/src/test/mir-opt/dataflow-const-prop/self_assign.rs @@ -0,0 +1,13 @@ +// unit-test: DataflowConstProp +// compile-flags: -Zunsound-mir-opts + +// EMIT_MIR self_assign.main.DataflowConstProp.diff +fn main() { + let mut a = 0; + a = a + 1; + a = a; + + let mut b = &a; + b = b; + a = *b; +} diff --git a/src/test/mir-opt/dataflow-const-prop/self_assign_add.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/self_assign_add.main.DataflowConstProp.diff new file mode 100644 index 00000000000..c09e4061ede --- /dev/null +++ b/src/test/mir-opt/dataflow-const-prop/self_assign_add.main.DataflowConstProp.diff @@ -0,0 +1,23 @@ +- // MIR for `main` before DataflowConstProp ++ // MIR for `main` after DataflowConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/self_assign_add.rs:+0:11: +0:11 + let mut _1: i32; // in scope 0 at $DIR/self_assign_add.rs:+1:9: +1:14 + scope 1 { + debug a => _1; // in scope 1 at $DIR/self_assign_add.rs:+1:9: +1:14 + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/self_assign_add.rs:+1:9: +1:14 + _1 = const 0_i32; // scope 0 at $DIR/self_assign_add.rs:+1:17: +1:18 +- _1 = Add(_1, const 1_i32); // scope 1 at $DIR/self_assign_add.rs:+2:5: +2:11 +- _1 = Add(_1, const 1_i32); // scope 1 at $DIR/self_assign_add.rs:+3:5: +3:11 ++ _1 = const 1_i32; // scope 1 at $DIR/self_assign_add.rs:+2:5: +2:11 ++ _1 = const 2_i32; // scope 1 at $DIR/self_assign_add.rs:+3:5: +3:11 + _0 = const (); // scope 0 at $DIR/self_assign_add.rs:+0:11: +4:2 + StorageDead(_1); // scope 0 at $DIR/self_assign_add.rs:+4:1: +4:2 + return; // scope 0 at $DIR/self_assign_add.rs:+4:2: +4:2 + } + } + diff --git a/src/test/mir-opt/dataflow-const-prop/self_assign_add.rs b/src/test/mir-opt/dataflow-const-prop/self_assign_add.rs new file mode 100644 index 00000000000..be2a4f04f62 --- /dev/null +++ b/src/test/mir-opt/dataflow-const-prop/self_assign_add.rs @@ -0,0 +1,9 @@ +// unit-test: DataflowConstProp +// compile-flags: -Zunsound-mir-opts + +// EMIT_MIR self_assign_add.main.DataflowConstProp.diff +fn main() { + let mut a = 0; + a += 1; + a += 1; +} diff --git a/src/test/mir-opt/dataflow-const-prop/static_ref.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/static_ref.main.DataflowConstProp.diff index 46386ca34d5..2d0d70b6a74 100644 --- a/src/test/mir-opt/dataflow-const-prop/static_ref.main.DataflowConstProp.diff +++ b/src/test/mir-opt/dataflow-const-prop/static_ref.main.DataflowConstProp.diff @@ -3,47 +3,47 @@ fn main() -> () { let mut _0: (); // return place in scope 0 at $DIR/static_ref.rs:+0:11: +0:11 - let _1: i32; // in scope 0 at $DIR/static_ref.rs:+2:9: +2:10 - let mut _3: &i32; // in scope 0 at $DIR/static_ref.rs:+4:9: +4:11 - let _4: &i32; // in scope 0 at $DIR/static_ref.rs:+4:9: +4:11 - let _5: &i32; // in scope 0 at $DIR/static_ref.rs:+4:10: +4:11 + let _1: i32; // in scope 0 at $DIR/static_ref.rs:+3:9: +3:10 + let mut _3: &i32; // in scope 0 at $DIR/static_ref.rs:+5:9: +5:11 + let _4: &i32; // in scope 0 at $DIR/static_ref.rs:+5:9: +5:11 + let _5: &i32; // in scope 0 at $DIR/static_ref.rs:+5:10: +5:11 scope 1 { - debug x => _1; // in scope 1 at $DIR/static_ref.rs:+2:9: +2:10 - let mut _2: &i32; // in scope 1 at $DIR/static_ref.rs:+3:9: +3:14 + debug x => _1; // in scope 1 at $DIR/static_ref.rs:+3:9: +3:10 + let mut _2: &i32; // in scope 1 at $DIR/static_ref.rs:+4:9: +4:14 scope 2 { - debug r => _2; // in scope 2 at $DIR/static_ref.rs:+3:9: +3:14 - let _6: i32; // in scope 2 at $DIR/static_ref.rs:+5:9: +5:10 + debug r => _2; // in scope 2 at $DIR/static_ref.rs:+4:9: +4:14 + let _6: i32; // in scope 2 at $DIR/static_ref.rs:+6:9: +6:10 scope 3 { - debug y => _6; // in scope 3 at $DIR/static_ref.rs:+5:9: +5:10 + debug y => _6; // in scope 3 at $DIR/static_ref.rs:+6:9: +6:10 } } } bb0: { - StorageLive(_1); // scope 0 at $DIR/static_ref.rs:+2:9: +2:10 - _1 = const 0_i32; // scope 0 at $DIR/static_ref.rs:+2:13: +2:14 - StorageLive(_2); // scope 1 at $DIR/static_ref.rs:+3:9: +3:14 - _2 = &_1; // scope 1 at $DIR/static_ref.rs:+3:17: +3:19 - StorageLive(_3); // scope 2 at $DIR/static_ref.rs:+4:9: +4:11 - StorageLive(_4); // scope 2 at $DIR/static_ref.rs:+4:9: +4:11 - StorageLive(_5); // scope 2 at $DIR/static_ref.rs:+4:10: +4:11 - _5 = const {alloc1: &i32}; // scope 2 at $DIR/static_ref.rs:+4:10: +4:11 + StorageLive(_1); // scope 0 at $DIR/static_ref.rs:+3:9: +3:10 + _1 = const 0_i32; // scope 0 at $DIR/static_ref.rs:+3:13: +3:14 + StorageLive(_2); // scope 1 at $DIR/static_ref.rs:+4:9: +4:14 + _2 = &_1; // scope 1 at $DIR/static_ref.rs:+4:17: +4:19 + StorageLive(_3); // scope 2 at $DIR/static_ref.rs:+5:9: +5:11 + StorageLive(_4); // scope 2 at $DIR/static_ref.rs:+5:9: +5:11 + StorageLive(_5); // scope 2 at $DIR/static_ref.rs:+5:10: +5:11 + _5 = const {alloc1: &i32}; // scope 2 at $DIR/static_ref.rs:+5:10: +5:11 // mir::Constant - // + span: $DIR/static_ref.rs:8:10: 8:11 + // + span: $DIR/static_ref.rs:10:10: 10:11 // + literal: Const { ty: &i32, val: Value(Scalar(alloc1)) } - _4 = &(*_5); // scope 2 at $DIR/static_ref.rs:+4:9: +4:11 - _3 = &(*_4); // scope 2 at $DIR/static_ref.rs:+4:9: +4:11 - _2 = move _3; // scope 2 at $DIR/static_ref.rs:+4:5: +4:11 - StorageDead(_3); // scope 2 at $DIR/static_ref.rs:+4:10: +4:11 - StorageDead(_5); // scope 2 at $DIR/static_ref.rs:+4:11: +4:12 - StorageDead(_4); // scope 2 at $DIR/static_ref.rs:+4:11: +4:12 - StorageLive(_6); // scope 2 at $DIR/static_ref.rs:+5:9: +5:10 - _6 = (*_2); // scope 2 at $DIR/static_ref.rs:+5:13: +5:15 - _0 = const (); // scope 0 at $DIR/static_ref.rs:+0:11: +6:2 - StorageDead(_6); // scope 2 at $DIR/static_ref.rs:+6:1: +6:2 - StorageDead(_2); // scope 1 at $DIR/static_ref.rs:+6:1: +6:2 - StorageDead(_1); // scope 0 at $DIR/static_ref.rs:+6:1: +6:2 - return; // scope 0 at $DIR/static_ref.rs:+6:2: +6:2 + _4 = &(*_5); // scope 2 at $DIR/static_ref.rs:+5:9: +5:11 + _3 = &(*_4); // scope 2 at $DIR/static_ref.rs:+5:9: +5:11 + _2 = move _3; // scope 2 at $DIR/static_ref.rs:+5:5: +5:11 + StorageDead(_3); // scope 2 at $DIR/static_ref.rs:+5:10: +5:11 + StorageDead(_5); // scope 2 at $DIR/static_ref.rs:+5:11: +5:12 + StorageDead(_4); // scope 2 at $DIR/static_ref.rs:+5:11: +5:12 + StorageLive(_6); // scope 2 at $DIR/static_ref.rs:+6:9: +6:10 + _6 = (*_2); // scope 2 at $DIR/static_ref.rs:+6:13: +6:15 + _0 = const (); // scope 0 at $DIR/static_ref.rs:+0:11: +7:2 + StorageDead(_6); // scope 2 at $DIR/static_ref.rs:+7:1: +7:2 + StorageDead(_2); // scope 1 at $DIR/static_ref.rs:+7:1: +7:2 + StorageDead(_1); // scope 0 at $DIR/static_ref.rs:+7:1: +7:2 + return; // scope 0 at $DIR/static_ref.rs:+7:2: +7:2 } } diff --git a/src/test/mir-opt/dataflow-const-prop/static_ref.rs b/src/test/mir-opt/dataflow-const-prop/static_ref.rs index 5e60ab1805b..90f20ae51ce 100644 --- a/src/test/mir-opt/dataflow-const-prop/static_ref.rs +++ b/src/test/mir-opt/dataflow-const-prop/static_ref.rs @@ -1,7 +1,9 @@ // unit-test: DataflowConstProp +// compile-flags: -Zunsound-mir-opts // EMIT_MIR static_ref.main.DataflowConstProp.diff fn main() { + // Currently, this will not propagate. static P: i32 = 5; let x = 0; let mut r = &x; diff --git a/src/test/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.diff index 1d01d4fd2e7..d1b8895901e 100644 --- a/src/test/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.diff +++ b/src/test/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.diff @@ -25,7 +25,7 @@ - _2 = foo(move _3) -> bb1; // scope 1 at $DIR/terminator.rs:+2:5: +2:15 + _2 = foo(const 2_i32) -> bb1; // scope 1 at $DIR/terminator.rs:+2:5: +2:15 // mir::Constant - // + span: $DIR/terminator.rs:8:5: 8:8 + // + span: $DIR/terminator.rs:9:5: 9:8 // + literal: Const { ty: fn(i32) {foo}, val: Value() } } diff --git a/src/test/mir-opt/dataflow-const-prop/terminator.rs b/src/test/mir-opt/dataflow-const-prop/terminator.rs index e96b25de63c..7d8bb58f684 100644 --- a/src/test/mir-opt/dataflow-const-prop/terminator.rs +++ b/src/test/mir-opt/dataflow-const-prop/terminator.rs @@ -1,4 +1,5 @@ // unit-test: DataflowConstProp +// compile-flags: -Zunsound-mir-opts fn foo(n: i32) {} diff --git a/src/test/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.diff new file mode 100644 index 00000000000..7fb1c8b7caf --- /dev/null +++ b/src/test/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.diff @@ -0,0 +1,86 @@ +- // MIR for `main` before DataflowConstProp ++ // MIR for `main` after DataflowConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/tuple.rs:+0:11: +0:11 + let mut _1: (i32, i32); // in scope 0 at $DIR/tuple.rs:+1:9: +1:14 + let mut _4: i32; // in scope 0 at $DIR/tuple.rs:+3:13: +3:22 + let mut _5: i32; // in scope 0 at $DIR/tuple.rs:+3:13: +3:16 + let mut _6: i32; // in scope 0 at $DIR/tuple.rs:+3:19: +3:22 + let mut _7: &(i32, i32); // in scope 0 at $DIR/tuple.rs:+5:9: +5:11 + let _8: &(i32, i32); // in scope 0 at $DIR/tuple.rs:+5:9: +5:11 + let mut _10: i32; // in scope 0 at $DIR/tuple.rs:+6:13: +6:22 + let mut _11: i32; // in scope 0 at $DIR/tuple.rs:+6:13: +6:16 + let mut _12: i32; // in scope 0 at $DIR/tuple.rs:+6:19: +6:22 + scope 1 { + debug a => _1; // in scope 1 at $DIR/tuple.rs:+1:9: +1:14 + let mut _2: &(i32, i32); // in scope 1 at $DIR/tuple.rs:+2:9: +2:14 + scope 2 { + debug b => _2; // in scope 2 at $DIR/tuple.rs:+2:9: +2:14 + let _3: i32; // in scope 2 at $DIR/tuple.rs:+3:9: +3:10 + scope 3 { + debug c => _3; // in scope 3 at $DIR/tuple.rs:+3:9: +3:10 + let _9: i32; // in scope 3 at $DIR/tuple.rs:+6:9: +6:10 + scope 4 { + debug d => _9; // in scope 4 at $DIR/tuple.rs:+6:9: +6:10 + } + } + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/tuple.rs:+1:9: +1:14 + Deinit(_1); // scope 0 at $DIR/tuple.rs:+1:17: +1:23 + (_1.0: i32) = const 1_i32; // scope 0 at $DIR/tuple.rs:+1:17: +1:23 + (_1.1: i32) = const 2_i32; // scope 0 at $DIR/tuple.rs:+1:17: +1:23 + StorageLive(_2); // scope 1 at $DIR/tuple.rs:+2:9: +2:14 + _2 = &_1; // scope 1 at $DIR/tuple.rs:+2:17: +2:19 + StorageLive(_3); // scope 2 at $DIR/tuple.rs:+3:9: +3:10 + StorageLive(_4); // scope 2 at $DIR/tuple.rs:+3:13: +3:22 + StorageLive(_5); // scope 2 at $DIR/tuple.rs:+3:13: +3:16 +- _5 = (_1.0: i32); // scope 2 at $DIR/tuple.rs:+3:13: +3:16 ++ _5 = const 1_i32; // scope 2 at $DIR/tuple.rs:+3:13: +3:16 + StorageLive(_6); // scope 2 at $DIR/tuple.rs:+3:19: +3:22 +- _6 = ((*_2).1: i32); // scope 2 at $DIR/tuple.rs:+3:19: +3:22 +- _4 = Add(move _5, move _6); // scope 2 at $DIR/tuple.rs:+3:13: +3:22 ++ _6 = const 2_i32; // scope 2 at $DIR/tuple.rs:+3:19: +3:22 ++ _4 = const 3_i32; // scope 2 at $DIR/tuple.rs:+3:13: +3:22 + StorageDead(_6); // scope 2 at $DIR/tuple.rs:+3:21: +3:22 + StorageDead(_5); // scope 2 at $DIR/tuple.rs:+3:21: +3:22 +- _3 = Add(move _4, const 3_i32); // scope 2 at $DIR/tuple.rs:+3:13: +3:26 ++ _3 = const 6_i32; // scope 2 at $DIR/tuple.rs:+3:13: +3:26 + StorageDead(_4); // scope 2 at $DIR/tuple.rs:+3:25: +3:26 + Deinit(_1); // scope 3 at $DIR/tuple.rs:+4:5: +4:15 + (_1.0: i32) = const 2_i32; // scope 3 at $DIR/tuple.rs:+4:5: +4:15 + (_1.1: i32) = const 3_i32; // scope 3 at $DIR/tuple.rs:+4:5: +4:15 + StorageLive(_7); // scope 3 at $DIR/tuple.rs:+5:9: +5:11 + StorageLive(_8); // scope 3 at $DIR/tuple.rs:+5:9: +5:11 + _8 = &_1; // scope 3 at $DIR/tuple.rs:+5:9: +5:11 + _7 = &(*_8); // scope 3 at $DIR/tuple.rs:+5:9: +5:11 + _2 = move _7; // scope 3 at $DIR/tuple.rs:+5:5: +5:11 + StorageDead(_7); // scope 3 at $DIR/tuple.rs:+5:10: +5:11 + StorageDead(_8); // scope 3 at $DIR/tuple.rs:+5:11: +5:12 + StorageLive(_9); // scope 3 at $DIR/tuple.rs:+6:9: +6:10 + StorageLive(_10); // scope 3 at $DIR/tuple.rs:+6:13: +6:22 + StorageLive(_11); // scope 3 at $DIR/tuple.rs:+6:13: +6:16 +- _11 = (_1.0: i32); // scope 3 at $DIR/tuple.rs:+6:13: +6:16 ++ _11 = const 2_i32; // scope 3 at $DIR/tuple.rs:+6:13: +6:16 + StorageLive(_12); // scope 3 at $DIR/tuple.rs:+6:19: +6:22 +- _12 = ((*_2).1: i32); // scope 3 at $DIR/tuple.rs:+6:19: +6:22 +- _10 = Add(move _11, move _12); // scope 3 at $DIR/tuple.rs:+6:13: +6:22 ++ _12 = const 3_i32; // scope 3 at $DIR/tuple.rs:+6:19: +6:22 ++ _10 = const 5_i32; // scope 3 at $DIR/tuple.rs:+6:13: +6:22 + StorageDead(_12); // scope 3 at $DIR/tuple.rs:+6:21: +6:22 + StorageDead(_11); // scope 3 at $DIR/tuple.rs:+6:21: +6:22 +- _9 = Add(move _10, const 4_i32); // scope 3 at $DIR/tuple.rs:+6:13: +6:26 ++ _9 = const 9_i32; // scope 3 at $DIR/tuple.rs:+6:13: +6:26 + StorageDead(_10); // scope 3 at $DIR/tuple.rs:+6:25: +6:26 + _0 = const (); // scope 0 at $DIR/tuple.rs:+0:11: +7:2 + StorageDead(_9); // scope 3 at $DIR/tuple.rs:+7:1: +7:2 + StorageDead(_3); // scope 2 at $DIR/tuple.rs:+7:1: +7:2 + StorageDead(_2); // scope 1 at $DIR/tuple.rs:+7:1: +7:2 + StorageDead(_1); // scope 0 at $DIR/tuple.rs:+7:1: +7:2 + return; // scope 0 at $DIR/tuple.rs:+7:2: +7:2 + } + } + diff --git a/src/test/mir-opt/dataflow-const-prop/tuple.rs b/src/test/mir-opt/dataflow-const-prop/tuple.rs new file mode 100644 index 00000000000..dfc49fe857a --- /dev/null +++ b/src/test/mir-opt/dataflow-const-prop/tuple.rs @@ -0,0 +1,12 @@ +// unit-test: DataflowConstProp +// compile-flags: -Zunsound-mir-opts + +// EMIT_MIR tuple.main.DataflowConstProp.diff +fn main() { + let mut a = (1, 2); + let mut b = &a; + let c = a.0 + b.1 + 3; + a = (2, 3); + b = &a; + let d = a.0 + b.1 + 4; +} diff --git a/src/test/mir-opt/dataflow-const-prop/unnamed.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/unnamed.main.DataflowConstProp.diff deleted file mode 100644 index 684c661fc11..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/unnamed.main.DataflowConstProp.diff +++ /dev/null @@ -1,38 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/unnamed.rs:+0:11: +0:11 - let mut _1: i32; // in scope 0 at $DIR/unnamed.rs:+1:9: +1:14 - let mut _2: i32; // in scope 0 at $DIR/unnamed.rs:+3:10: +3:11 - let mut _3: &i32; // in scope 0 at $DIR/unnamed.rs:+3:10: +3:11 - scope 1 { - debug a => _1; // in scope 1 at $DIR/unnamed.rs:+1:9: +1:14 - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/unnamed.rs:+1:9: +1:14 - _1 = const 0_i32; // scope 0 at $DIR/unnamed.rs:+1:17: +1:18 -- _1 = Add(_1, const 1_i32); // scope 1 at $DIR/unnamed.rs:+2:5: +2:11 -+ _1 = const 1_i32; // scope 1 at $DIR/unnamed.rs:+2:5: +2:11 - StorageLive(_2); // scope 1 at $DIR/unnamed.rs:+3:10: +3:11 - StorageLive(_3); // scope 1 at $DIR/unnamed.rs:+3:10: +3:11 - _3 = const {alloc1: &i32}; // scope 1 at $DIR/unnamed.rs:+3:10: +3:11 - // mir::Constant - // + span: $DIR/unnamed.rs:9:10: 9:11 - // + literal: Const { ty: &i32, val: Value(Scalar(alloc1)) } - _2 = (*_3); // scope 1 at $DIR/unnamed.rs:+3:10: +3:11 -- _1 = Add(_1, move _2); // scope 1 at $DIR/unnamed.rs:+3:5: +3:11 -+ _1 = Add(const 1_i32, move _2); // scope 1 at $DIR/unnamed.rs:+3:5: +3:11 - StorageDead(_2); // scope 1 at $DIR/unnamed.rs:+3:10: +3:11 - StorageDead(_3); // scope 1 at $DIR/unnamed.rs:+3:11: +3:12 - _0 = const (); // scope 0 at $DIR/unnamed.rs:+0:11: +4:2 - StorageDead(_1); // scope 0 at $DIR/unnamed.rs:+4:1: +4:2 - return; // scope 0 at $DIR/unnamed.rs:+4:2: +4:2 - } - } - - alloc1 (static: g, size: 4, align: 4) { - 02 00 00 00 │ .... - } - diff --git a/src/test/mir-opt/dataflow-const-prop/unnamed.rs b/src/test/mir-opt/dataflow-const-prop/unnamed.rs deleted file mode 100644 index 91f5a9e1c12..00000000000 --- a/src/test/mir-opt/dataflow-const-prop/unnamed.rs +++ /dev/null @@ -1,10 +0,0 @@ -// unit-test: DataflowConstProp - -static g: i32 = 2; - -// EMIT_MIR unnamed.main.DataflowConstProp.diff -fn main() { - let mut a = 0; - a += 1; - a += g; -}