Skip to content

Commit c72cfdd

Browse files
authored
Rollup merge of #124196 - RalfJung:mir-opt-tests, r=Mark-Simulacrum
mir-opt tests: rename unit-test -> test-mir-pass "unit-test" is extremely non-descriptive, no idea how one is supposed to read that and know that this specifies the MIR pass being tested.
2 parents b3f9117 + 75d0fdd commit c72cfdd

File tree

152 files changed

+157
-156
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+157
-156
lines changed

src/tools/compiletest/src/header.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ mod directives {
244244
pub const STDERR_PER_BITWIDTH: &'static str = "stderr-per-bitwidth";
245245
pub const INCREMENTAL: &'static str = "incremental";
246246
pub const KNOWN_BUG: &'static str = "known-bug";
247-
pub const MIR_UNIT_TEST: &'static str = "unit-test";
247+
pub const TEST_MIR_PASS: &'static str = "test-mir-pass";
248248
pub const REMAP_SRC_BASE: &'static str = "remap-src-base";
249249
pub const COMPARE_OUTPUT_LINES_BY_SUBSET: &'static str = "compare-output-lines-by-subset";
250250
pub const LLVM_COV_FLAGS: &'static str = "llvm-cov-flags";
@@ -549,7 +549,7 @@ impl TestProps {
549549

550550
config.set_name_value_directive(
551551
ln,
552-
MIR_UNIT_TEST,
552+
TEST_MIR_PASS,
553553
&mut self.mir_unit_test,
554554
|s| s.trim().to_string(),
555555
);
@@ -922,7 +922,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
922922
"should-fail",
923923
"should-ice",
924924
"stderr-per-bitwidth",
925-
"unit-test",
925+
"test-mir-pass",
926926
"unset-exec-env",
927927
"unset-rustc-env",
928928
// tidy-alphabetical-end

tests/mir-opt/README.md

+4-3

tests/mir-opt/array_index_is_temporary.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: SimplifyCfg-pre-optimizations
1+
//@ test-mir-pass: SimplifyCfg-pre-optimizations
22
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
33
// Retagging (from Stacked Borrows) relies on the array index being a fresh
44
// temporary, so that side-effects cannot change it.

tests/mir-opt/basic_assignment.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: ElaborateDrops
1+
//@ test-mir-pass: ElaborateDrops
22
//@ needs-unwind
33
// this tests move up progration, which is not yet implemented
44

tests/mir-opt/box_expr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: ElaborateDrops
1+
//@ test-mir-pass: ElaborateDrops
22
//@ needs-unwind
33

44
#![feature(rustc_attrs, stmt_expr_attributes)]

tests/mir-opt/const_allocation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// skip-filecheck
2-
//@ unit-test: GVN
2+
//@ test-mir-pass: GVN
33
//@ ignore-endian-big
44
// EMIT_MIR_FOR_EACH_BIT_WIDTH
55
static FOO: &[(Option<i32>, &[&str])] =

tests/mir-opt/const_allocation2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// skip-filecheck
2-
//@ unit-test: GVN
2+
//@ test-mir-pass: GVN
33
//@ ignore-endian-big
44
// EMIT_MIR_FOR_EACH_BIT_WIDTH
55
// EMIT_MIR const_allocation2.main.GVN.after.mir

tests/mir-opt/const_allocation3.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// skip-filecheck
2-
//@ unit-test: GVN
2+
//@ test-mir-pass: GVN
33
//@ ignore-endian-big
44
// EMIT_MIR_FOR_EACH_BIT_WIDTH
55
// EMIT_MIR const_allocation3.main.GVN.after.mir

tests/mir-opt/const_debuginfo.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: ConstDebugInfo
1+
//@ test-mir-pass: ConstDebugInfo
22
//@ compile-flags: -C overflow-checks=no -Zmir-enable-passes=+GVN
33

44
struct Point {

tests/mir-opt/const_prop/address_of_pair.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: GVN
1+
//@ test-mir-pass: GVN
22

33
// EMIT_MIR address_of_pair.fn0.GVN.diff
44
pub fn fn0() -> bool {

tests/mir-opt/const_prop/aggregate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
2-
//@ unit-test: GVN
2+
//@ test-mir-pass: GVN
33
//@ compile-flags: -O
44

55
// EMIT_MIR aggregate.main.GVN.diff

tests/mir-opt/const_prop/array_index.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: GVN
1+
//@ test-mir-pass: GVN
22
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
33
// EMIT_MIR_FOR_EACH_BIT_WIDTH
44

tests/mir-opt/const_prop/bad_op_div_by_zero.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: GVN
1+
//@ test-mir-pass: GVN
22
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
33

44
// EMIT_MIR bad_op_div_by_zero.main.GVN.diff

tests/mir-opt/const_prop/bad_op_mod_by_zero.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: GVN
1+
//@ test-mir-pass: GVN
22
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
33

44
// EMIT_MIR bad_op_mod_by_zero.main.GVN.diff

tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: GVN
1+
//@ test-mir-pass: GVN
22
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
33
// EMIT_MIR_FOR_EACH_BIT_WIDTH
44

tests/mir-opt/const_prop/boolean_identities.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: GVN
1+
//@ test-mir-pass: GVN
22

33
// EMIT_MIR boolean_identities.test.GVN.diff
44
pub fn test(x: bool, y: bool) -> bool {

tests/mir-opt/const_prop/boxes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: GVN
1+
//@ test-mir-pass: GVN
22
//@ compile-flags: -O
33
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
44

tests/mir-opt/const_prop/cast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: GVN
1+
//@ test-mir-pass: GVN
22
// EMIT_MIR cast.main.GVN.diff
33

44
fn main() {

tests/mir-opt/const_prop/checked_add.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
2-
//@ unit-test: GVN
2+
//@ test-mir-pass: GVN
33
//@ compile-flags: -C overflow-checks=on
44

55
// EMIT_MIR checked_add.main.GVN.diff

tests/mir-opt/const_prop/control_flow_simplification.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// skip-filecheck
22
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
3-
//@ unit-test: GVN
3+
//@ test-mir-pass: GVN
44
//@ compile-flags: -Zmir-opt-level=1
55

66
trait NeedsDrop: Sized {

tests/mir-opt/const_prop/discriminant.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: GVN
1+
//@ test-mir-pass: GVN
22

33
// FIXME(wesleywiser): Ideally, we could const-prop away all of this and just be left with
44
// `let x = 42` but that doesn't work because const-prop doesn't support `Operand::Indirect`

tests/mir-opt/const_prop/indirect.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
2-
//@ unit-test: GVN
2+
//@ test-mir-pass: GVN
33
//@ compile-flags: -C overflow-checks=on
44

55
// EMIT_MIR indirect.main.GVN.diff

tests/mir-opt/const_prop/indirect_mutation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: GVN
1+
//@ test-mir-pass: GVN
22
// Check that we do not propagate past an indirect mutation.
33
#![feature(raw_ref_op)]
44

tests/mir-opt/const_prop/inherit_overflow.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
2-
//@ unit-test: GVN
2+
//@ test-mir-pass: GVN
33
//@ compile-flags: -Zmir-enable-passes=+Inline
44

55
// After inlining, this will contain a `CheckedBinaryOp`.

tests/mir-opt/const_prop/invalid_constant.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// skip-filecheck
2-
//@ unit-test: GVN
2+
//@ test-mir-pass: GVN
33
//@ compile-flags: -Zmir-enable-passes=+RemoveZsts
44
// Verify that we can pretty print invalid constants.
55

tests/mir-opt/const_prop/issue_66971.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
2-
//@ unit-test: GVN
2+
//@ test-mir-pass: GVN
33

44
// Due to a bug in propagating scalar pairs the assertion below used to fail. In the expected
55
// outputs below, after GVN this is how _2 would look like with the bug:

tests/mir-opt/const_prop/issue_67019.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
2-
//@ unit-test: GVN
2+
//@ test-mir-pass: GVN
33

44
// This used to ICE in const-prop
55

tests/mir-opt/const_prop/large_array_index.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// skip-filecheck
2-
//@ unit-test: GVN
2+
//@ test-mir-pass: GVN
33
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
44
// EMIT_MIR_FOR_EACH_BIT_WIDTH
55

tests/mir-opt/const_prop/mult_by_zero.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: GVN
1+
//@ test-mir-pass: GVN
22

33
// EMIT_MIR mult_by_zero.test.GVN.diff
44
fn test(x: i32) -> i32 {

tests/mir-opt/const_prop/mutable_variable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: GVN
1+
//@ test-mir-pass: GVN
22

33
// EMIT_MIR mutable_variable.main.GVN.diff
44
fn main() {

tests/mir-opt/const_prop/mutable_variable_aggregate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: GVN
1+
//@ test-mir-pass: GVN
22

33
// EMIT_MIR mutable_variable_aggregate.main.GVN.diff
44
fn main() {

tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: GVN
1+
//@ test-mir-pass: GVN
22

33
// EMIT_MIR mutable_variable_aggregate_mut_ref.main.GVN.diff
44
fn main() {

tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
2-
//@ unit-test: GVN
2+
//@ test-mir-pass: GVN
33

44
// EMIT_MIR mutable_variable_aggregate_partial_read.main.GVN.diff
55
fn main() {

tests/mir-opt/const_prop/mutable_variable_no_prop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: GVN
1+
//@ test-mir-pass: GVN
22

33
// Verify that we do not propagate the contents of this mutable static.
44
static mut STATIC: u32 = 0x42424242;

tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
2-
//@ unit-test: GVN
2+
//@ test-mir-pass: GVN
33

44
// EMIT_MIR mutable_variable_unprop_assign.main.GVN.diff
55
fn main() {

tests/mir-opt/const_prop/offset_of.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// skip-filecheck
2-
//@ unit-test: GVN
2+
//@ test-mir-pass: GVN
33
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
44

55
#![feature(offset_of_enum, offset_of_nested)]

tests/mir-opt/const_prop/overwrite_with_const_with_params.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: GVN
1+
//@ test-mir-pass: GVN
22
//@ compile-flags: -O
33

44
// Regression test for https://github.com/rust-lang/rust/issues/118328

tests/mir-opt/const_prop/pointer_expose_provenance.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
2-
//@ unit-test: GVN
2+
//@ test-mir-pass: GVN
33

44
#[inline(never)]
55
fn read(_: usize) { }

tests/mir-opt/const_prop/read_immutable_static.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: GVN
1+
//@ test-mir-pass: GVN
22

33
static FOO: u8 = 2;
44

tests/mir-opt/const_prop/ref_deref.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: GVN
1+
//@ test-mir-pass: GVN
22

33
// EMIT_MIR ref_deref.main.GVN.diff
44
fn main() {

tests/mir-opt/const_prop/ref_deref_project.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// This does not currently propagate (#67862)
2-
//@ unit-test: GVN
2+
//@ test-mir-pass: GVN
33

44
// EMIT_MIR ref_deref_project.main.GVN.diff
55
fn main() {

tests/mir-opt/const_prop/reify_fn_ptr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: GVN
1+
//@ test-mir-pass: GVN
22
// EMIT_MIR reify_fn_ptr.main.GVN.diff
33

44
fn main() {

tests/mir-opt/const_prop/repeat.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: GVN
1+
//@ test-mir-pass: GVN
22
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
33
// EMIT_MIR_FOR_EACH_BIT_WIDTH
44

tests/mir-opt/const_prop/return_place.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: GVN
1+
//@ test-mir-pass: GVN
22
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
33
//@ compile-flags: -C overflow-checks=on
44

tests/mir-opt/const_prop/scalar_literal_propagation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: GVN
1+
//@ test-mir-pass: GVN
22
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
33

44
// EMIT_MIR scalar_literal_propagation.main.GVN.diff

tests/mir-opt/const_prop/slice_len.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: GVN
1+
//@ test-mir-pass: GVN
22
//@ compile-flags: -Zmir-enable-passes=+InstSimplify
33
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
44
// EMIT_MIR_FOR_EACH_BIT_WIDTH

tests/mir-opt/const_prop/switch_int.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: GVN
1+
//@ test-mir-pass: GVN
22
//@ compile-flags: -Zmir-enable-passes=+SimplifyConstCondition-after-const-prop
33
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
44

tests/mir-opt/const_prop/transmute.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: GVN
1+
//@ test-mir-pass: GVN
22
//@ compile-flags: -O --crate-type=lib
33
//@ ignore-endian-big
44
// EMIT_MIR_FOR_EACH_BIT_WIDTH

tests/mir-opt/const_prop/tuple_literal_propagation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: GVN
1+
//@ test-mir-pass: GVN
22
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
33
// EMIT_MIR tuple_literal_propagation.main.GVN.diff
44

tests/mir-opt/const_prop/while_let_loops.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: GVN
1+
//@ test-mir-pass: GVN
22
// EMIT_MIR while_let_loops.change_loop_body.GVN.diff
33

44
pub fn change_loop_body() {

tests/mir-opt/copy-prop/borrowed_local.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// skip-filecheck
22
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
3-
//@ unit-test: CopyProp
3+
//@ test-mir-pass: CopyProp
44

55
#![feature(custom_mir, core_intrinsics)]
66
#![allow(unused_assignments)]

tests/mir-opt/copy-prop/branch.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// skip-filecheck
22
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
33
//! Tests that we bail out when there are multiple assignments to the same local.
4-
//@ unit-test: CopyProp
4+
//@ test-mir-pass: CopyProp
55
fn val() -> i32 {
66
1
77
}

tests/mir-opt/copy-prop/calls.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// skip-filecheck
22
// Check that CopyProp does propagate return values of call terminators.
3-
//@ unit-test: CopyProp
3+
//@ test-mir-pass: CopyProp
44
//@ needs-unwind
55

66
#![feature(custom_mir, core_intrinsics)]

tests/mir-opt/copy-prop/copy_propagation_arg.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
33
// Check that CopyProp does not propagate an assignment to a function argument
44
// (doing so can break usages of the original argument value)
5-
//@ unit-test: CopyProp
5+
//@ test-mir-pass: CopyProp
66
fn dummy(x: u8) -> u8 {
77
x
88
}

tests/mir-opt/copy-prop/custom_move_arg.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// skip-filecheck
22
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
3-
//@ unit-test: CopyProp
3+
//@ test-mir-pass: CopyProp
44

55
#![feature(custom_mir, core_intrinsics)]
66
#![allow(unused_assignments)]

0 commit comments

Comments
 (0)