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.
This commit is contained in:
许杰友 Jieyou Xu (Joe) 2024-04-20 21:45:38 +01:00 committed by GitHub
commit c72cfdd46f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
152 changed files with 157 additions and 156 deletions

View File

@ -244,7 +244,7 @@ mod directives {
pub const STDERR_PER_BITWIDTH: &'static str = "stderr-per-bitwidth";
pub const INCREMENTAL: &'static str = "incremental";
pub const KNOWN_BUG: &'static str = "known-bug";
pub const MIR_UNIT_TEST: &'static str = "unit-test";
pub const TEST_MIR_PASS: &'static str = "test-mir-pass";
pub const REMAP_SRC_BASE: &'static str = "remap-src-base";
pub const COMPARE_OUTPUT_LINES_BY_SUBSET: &'static str = "compare-output-lines-by-subset";
pub const LLVM_COV_FLAGS: &'static str = "llvm-cov-flags";
@ -549,7 +549,7 @@ impl TestProps {
config.set_name_value_directive(
ln,
MIR_UNIT_TEST,
TEST_MIR_PASS,
&mut self.mir_unit_test,
|s| s.trim().to_string(),
);
@ -922,7 +922,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
"should-fail",
"should-ice",
"stderr-per-bitwidth",
"unit-test",
"test-mir-pass",
"unset-exec-env",
"unset-rustc-env",
// tidy-alphabetical-end

View File

@ -14,17 +14,18 @@ presence of pointers in constants or other bit width dependent things. In that c
to your test, causing separate files to be generated for 32bit and 64bit systems.
## Unit testing
## Testing a particular MIR pass
If you are only testing the behavior of a particular mir-opt pass on some specific input (as is
usually the case), you should add
```
// unit-test: PassName
//@ test-mir-pass: PassName
```
to the top of the file. This makes sure that other passes don't run which means you'll get the input
you expected and your test won't break when other code changes.
you expected and your test won't break when other code changes. This also lets you test passes
that are disabled by default.
## Emit a diff of the mir for a specific optimization

View File

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

View File

@ -1,4 +1,4 @@
//@ unit-test: ElaborateDrops
//@ test-mir-pass: ElaborateDrops
//@ needs-unwind
// this tests move up progration, which is not yet implemented

View File

@ -1,4 +1,4 @@
//@ unit-test: ElaborateDrops
//@ test-mir-pass: ElaborateDrops
//@ needs-unwind
#![feature(rustc_attrs, stmt_expr_attributes)]

View File

@ -1,5 +1,5 @@
// skip-filecheck
//@ unit-test: GVN
//@ test-mir-pass: GVN
//@ ignore-endian-big
// EMIT_MIR_FOR_EACH_BIT_WIDTH
static FOO: &[(Option<i32>, &[&str])] =

View File

@ -1,5 +1,5 @@
// skip-filecheck
//@ unit-test: GVN
//@ test-mir-pass: GVN
//@ ignore-endian-big
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR const_allocation2.main.GVN.after.mir

View File

@ -1,5 +1,5 @@
// skip-filecheck
//@ unit-test: GVN
//@ test-mir-pass: GVN
//@ ignore-endian-big
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR const_allocation3.main.GVN.after.mir

View File

@ -1,4 +1,4 @@
//@ unit-test: ConstDebugInfo
//@ test-mir-pass: ConstDebugInfo
//@ compile-flags: -C overflow-checks=no -Zmir-enable-passes=+GVN
struct Point {

View File

@ -1,4 +1,4 @@
//@ unit-test: GVN
//@ test-mir-pass: GVN
// EMIT_MIR address_of_pair.fn0.GVN.diff
pub fn fn0() -> bool {

View File

@ -1,5 +1,5 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ unit-test: GVN
//@ test-mir-pass: GVN
//@ compile-flags: -O
// EMIT_MIR aggregate.main.GVN.diff

View File

@ -1,4 +1,4 @@
//@ unit-test: GVN
//@ test-mir-pass: GVN
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR_FOR_EACH_BIT_WIDTH

View File

@ -1,4 +1,4 @@
//@ unit-test: GVN
//@ test-mir-pass: GVN
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR bad_op_div_by_zero.main.GVN.diff

View File

@ -1,4 +1,4 @@
//@ unit-test: GVN
//@ test-mir-pass: GVN
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR bad_op_mod_by_zero.main.GVN.diff

View File

@ -1,4 +1,4 @@
//@ unit-test: GVN
//@ test-mir-pass: GVN
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR_FOR_EACH_BIT_WIDTH

View File

@ -1,4 +1,4 @@
//@ unit-test: GVN
//@ test-mir-pass: GVN
// EMIT_MIR boolean_identities.test.GVN.diff
pub fn test(x: bool, y: bool) -> bool {

View File

@ -1,4 +1,4 @@
//@ unit-test: GVN
//@ test-mir-pass: GVN
//@ compile-flags: -O
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY

View File

@ -1,4 +1,4 @@
//@ unit-test: GVN
//@ test-mir-pass: GVN
// EMIT_MIR cast.main.GVN.diff
fn main() {

View File

@ -1,5 +1,5 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ unit-test: GVN
//@ test-mir-pass: GVN
//@ compile-flags: -C overflow-checks=on
// EMIT_MIR checked_add.main.GVN.diff

View File

@ -1,6 +1,6 @@
// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ unit-test: GVN
//@ test-mir-pass: GVN
//@ compile-flags: -Zmir-opt-level=1
trait NeedsDrop: Sized {

View File

@ -1,4 +1,4 @@
//@ unit-test: GVN
//@ test-mir-pass: GVN
// 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`

View File

@ -1,5 +1,5 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ unit-test: GVN
//@ test-mir-pass: GVN
//@ compile-flags: -C overflow-checks=on
// EMIT_MIR indirect.main.GVN.diff

View File

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

View File

@ -1,5 +1,5 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ unit-test: GVN
//@ test-mir-pass: GVN
//@ compile-flags: -Zmir-enable-passes=+Inline
// After inlining, this will contain a `CheckedBinaryOp`.

View File

@ -1,5 +1,5 @@
// skip-filecheck
//@ unit-test: GVN
//@ test-mir-pass: GVN
//@ compile-flags: -Zmir-enable-passes=+RemoveZsts
// Verify that we can pretty print invalid constants.

View File

@ -1,5 +1,5 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ unit-test: GVN
//@ test-mir-pass: GVN
// Due to a bug in propagating scalar pairs the assertion below used to fail. In the expected
// outputs below, after GVN this is how _2 would look like with the bug:

View File

@ -1,5 +1,5 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ unit-test: GVN
//@ test-mir-pass: GVN
// This used to ICE in const-prop

View File

@ -1,5 +1,5 @@
// skip-filecheck
//@ unit-test: GVN
//@ test-mir-pass: GVN
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR_FOR_EACH_BIT_WIDTH

View File

@ -1,4 +1,4 @@
//@ unit-test: GVN
//@ test-mir-pass: GVN
// EMIT_MIR mult_by_zero.test.GVN.diff
fn test(x: i32) -> i32 {

View File

@ -1,4 +1,4 @@
//@ unit-test: GVN
//@ test-mir-pass: GVN
// EMIT_MIR mutable_variable.main.GVN.diff
fn main() {

View File

@ -1,4 +1,4 @@
//@ unit-test: GVN
//@ test-mir-pass: GVN
// EMIT_MIR mutable_variable_aggregate.main.GVN.diff
fn main() {

View File

@ -1,4 +1,4 @@
//@ unit-test: GVN
//@ test-mir-pass: GVN
// EMIT_MIR mutable_variable_aggregate_mut_ref.main.GVN.diff
fn main() {

View File

@ -1,5 +1,5 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ unit-test: GVN
//@ test-mir-pass: GVN
// EMIT_MIR mutable_variable_aggregate_partial_read.main.GVN.diff
fn main() {

View File

@ -1,4 +1,4 @@
//@ unit-test: GVN
//@ test-mir-pass: GVN
// Verify that we do not propagate the contents of this mutable static.
static mut STATIC: u32 = 0x42424242;

View File

@ -1,5 +1,5 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ unit-test: GVN
//@ test-mir-pass: GVN
// EMIT_MIR mutable_variable_unprop_assign.main.GVN.diff
fn main() {

View File

@ -1,5 +1,5 @@
// skip-filecheck
//@ unit-test: GVN
//@ test-mir-pass: GVN
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
#![feature(offset_of_enum, offset_of_nested)]

View File

@ -1,4 +1,4 @@
//@ unit-test: GVN
//@ test-mir-pass: GVN
//@ compile-flags: -O
// Regression test for https://github.com/rust-lang/rust/issues/118328

View File

@ -1,5 +1,5 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ unit-test: GVN
//@ test-mir-pass: GVN
#[inline(never)]
fn read(_: usize) { }

View File

@ -1,4 +1,4 @@
//@ unit-test: GVN
//@ test-mir-pass: GVN
static FOO: u8 = 2;

View File

@ -1,4 +1,4 @@
//@ unit-test: GVN
//@ test-mir-pass: GVN
// EMIT_MIR ref_deref.main.GVN.diff
fn main() {

View File

@ -1,5 +1,5 @@
// This does not currently propagate (#67862)
//@ unit-test: GVN
//@ test-mir-pass: GVN
// EMIT_MIR ref_deref_project.main.GVN.diff
fn main() {

View File

@ -1,4 +1,4 @@
//@ unit-test: GVN
//@ test-mir-pass: GVN
// EMIT_MIR reify_fn_ptr.main.GVN.diff
fn main() {

View File

@ -1,4 +1,4 @@
//@ unit-test: GVN
//@ test-mir-pass: GVN
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR_FOR_EACH_BIT_WIDTH

View File

@ -1,4 +1,4 @@
//@ unit-test: GVN
//@ test-mir-pass: GVN
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ compile-flags: -C overflow-checks=on

View File

@ -1,4 +1,4 @@
//@ unit-test: GVN
//@ test-mir-pass: GVN
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR scalar_literal_propagation.main.GVN.diff

View File

@ -1,4 +1,4 @@
//@ unit-test: GVN
//@ test-mir-pass: GVN
//@ compile-flags: -Zmir-enable-passes=+InstSimplify
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR_FOR_EACH_BIT_WIDTH

View File

@ -1,4 +1,4 @@
//@ unit-test: GVN
//@ test-mir-pass: GVN
//@ compile-flags: -Zmir-enable-passes=+SimplifyConstCondition-after-const-prop
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY

View File

@ -1,4 +1,4 @@
//@ unit-test: GVN
//@ test-mir-pass: GVN
//@ compile-flags: -O --crate-type=lib
//@ ignore-endian-big
// EMIT_MIR_FOR_EACH_BIT_WIDTH

View File

@ -1,4 +1,4 @@
//@ unit-test: GVN
//@ test-mir-pass: GVN
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR tuple_literal_propagation.main.GVN.diff

View File

@ -1,4 +1,4 @@
//@ unit-test: GVN
//@ test-mir-pass: GVN
// EMIT_MIR while_let_loops.change_loop_body.GVN.diff
pub fn change_loop_body() {

View File

@ -1,6 +1,6 @@
// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ unit-test: CopyProp
//@ test-mir-pass: CopyProp
#![feature(custom_mir, core_intrinsics)]
#![allow(unused_assignments)]

View File

@ -1,7 +1,7 @@
// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//! Tests that we bail out when there are multiple assignments to the same local.
//@ unit-test: CopyProp
//@ test-mir-pass: CopyProp
fn val() -> i32 {
1
}

View File

@ -1,6 +1,6 @@
// skip-filecheck
// Check that CopyProp does propagate return values of call terminators.
//@ unit-test: CopyProp
//@ test-mir-pass: CopyProp
//@ needs-unwind
#![feature(custom_mir, core_intrinsics)]

View File

@ -2,7 +2,7 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// Check that CopyProp does not propagate an assignment to a function argument
// (doing so can break usages of the original argument value)
//@ unit-test: CopyProp
//@ test-mir-pass: CopyProp
fn dummy(x: u8) -> u8 {
x
}

View File

@ -1,6 +1,6 @@
// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ unit-test: CopyProp
//@ test-mir-pass: CopyProp
#![feature(custom_mir, core_intrinsics)]
#![allow(unused_assignments)]

View File

@ -1,7 +1,7 @@
// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//! Tests that cyclic assignments don't hang CopyProp, and result in reasonable code.
//@ unit-test: CopyProp
//@ test-mir-pass: CopyProp
fn val() -> i32 {
1
}

View File

@ -1,6 +1,6 @@
// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ unit-test: CopyProp
//@ test-mir-pass: CopyProp
fn id<T>(x: T) -> T {
x

View File

@ -3,7 +3,7 @@
// This is a copy of the `dead_stores_79191` test, except that we turn on DSE. This demonstrates
// that that pass enables this one to do more optimizations.
//@ unit-test: CopyProp
//@ test-mir-pass: CopyProp
//@ compile-flags: -Zmir-enable-passes=+DeadStoreElimination
fn id<T>(x: T) -> T {

View File

@ -1,6 +1,6 @@
// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ unit-test: CopyProp
//@ test-mir-pass: CopyProp
// EMIT_MIR issue_107511.main.CopyProp.diff
fn main() {

View File

@ -1,7 +1,7 @@
// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// Test that we do not move multiple times from the same local.
//@ unit-test: CopyProp
//@ test-mir-pass: CopyProp
// EMIT_MIR move_arg.f.CopyProp.diff
pub fn f<T: Copy>(a: T) {

View File

@ -1,6 +1,6 @@
// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ unit-test: CopyProp
//@ test-mir-pass: CopyProp
#![feature(custom_mir, core_intrinsics)]
#![allow(unused_assignments)]

View File

@ -1,5 +1,5 @@
// skip-filecheck
//@ unit-test: CopyProp
//@ test-mir-pass: CopyProp
//
// This attempts to mutate `a` via a pointer derived from `addr_of!(a)`. That is UB
// according to Miri. However, the decision to make this UB - and to allow

View File

@ -1,5 +1,5 @@
// skip-filecheck
//@ unit-test: CopyProp
//@ test-mir-pass: CopyProp
#![feature(custom_mir, core_intrinsics)]
#![allow(unused_assignments)]

View File

@ -1,5 +1,5 @@
// skip-filecheck
//@ unit-test: CopyProp
//@ test-mir-pass: CopyProp
// Verify that we do not ICE on partial initializations.
#![feature(custom_mir, core_intrinsics)]

View File

@ -1,7 +1,7 @@
// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// Check that CopyProp considers reborrows as not mutating the pointer.
//@ unit-test: CopyProp
//@ test-mir-pass: CopyProp
#![feature(raw_ref_op)]

View File

@ -1,5 +1,5 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ unit-test: DataflowConstProp
//@ test-mir-pass: DataflowConstProp
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR array_index.main.DataflowConstProp.diff

View File

@ -1,4 +1,4 @@
//@ unit-test: DataflowConstProp
//@ test-mir-pass: DataflowConstProp
// EMIT_MIR boolean_identities.test.DataflowConstProp.diff

View File

@ -1,4 +1,4 @@
//@ unit-test: DataflowConstProp
//@ test-mir-pass: DataflowConstProp
// EMIT_MIR cast.main.DataflowConstProp.diff

View File

@ -1,4 +1,4 @@
//@ unit-test: DataflowConstProp
//@ test-mir-pass: DataflowConstProp
//@ compile-flags: -Coverflow-checks=on
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY

View File

@ -1,4 +1,4 @@
//@ unit-test: DataflowConstProp
//@ test-mir-pass: DataflowConstProp
//@ compile-flags: -Zmir-enable-passes=+GVN,+Inline
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY

View File

@ -1,4 +1,4 @@
//@ unit-test: DataflowConstProp
//@ test-mir-pass: DataflowConstProp
// EMIT_MIR_FOR_EACH_BIT_WIDTH
#![feature(custom_mir, core_intrinsics, rustc_attrs)]

View File

@ -1,4 +1,4 @@
//@ unit-test: DataflowConstProp
//@ test-mir-pass: DataflowConstProp
// EMIT_MIR if.main.DataflowConstProp.diff
// CHECK-LABEL: fn main(

View File

@ -1,5 +1,5 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ unit-test: DataflowConstProp
//@ test-mir-pass: DataflowConstProp
//@ compile-flags: -Zmir-enable-passes=+Inline
// EMIT_MIR inherit_overflow.main.DataflowConstProp.diff

View File

@ -1,4 +1,4 @@
//@ unit-test: DataflowConstProp
//@ test-mir-pass: DataflowConstProp
// EMIT_MIR issue_81605.f.DataflowConstProp.diff

View File

@ -1,4 +1,4 @@
//@ unit-test: DataflowConstProp
//@ test-mir-pass: DataflowConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR_FOR_EACH_BIT_WIDTH

View File

@ -1,4 +1,4 @@
//@ unit-test: DataflowConstProp
//@ test-mir-pass: DataflowConstProp
// EMIT_MIR mult_by_zero.test.DataflowConstProp.diff
// CHECK-LABEL: fn test(

View File

@ -1,4 +1,4 @@
//@ unit-test: DataflowConstProp
//@ test-mir-pass: DataflowConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
#![feature(offset_of_nested)]

View File

@ -1,5 +1,5 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ unit-test: DataflowConstProp
//@ test-mir-pass: DataflowConstProp
#[inline(never)]
fn escape<T>(x: &T) {}

View File

@ -1,4 +1,4 @@
//@ unit-test: DataflowConstProp
//@ test-mir-pass: DataflowConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR_FOR_EACH_BIT_WIDTH

View File

@ -1,4 +1,4 @@
//@ unit-test: DataflowConstProp
//@ test-mir-pass: DataflowConstProp
// The struct has scalar ABI, but is not a scalar type.
// Make sure that we handle this correctly.

View File

@ -1,4 +1,4 @@
//@ unit-test: DataflowConstProp
//@ test-mir-pass: DataflowConstProp
// EMIT_MIR self_assign.main.DataflowConstProp.diff

View File

@ -1,4 +1,4 @@
//@ unit-test: DataflowConstProp
//@ test-mir-pass: DataflowConstProp
// EMIT_MIR self_assign_add.main.DataflowConstProp.diff

View File

@ -6,7 +6,7 @@
// used to modify `x.1` - if it did not, then it might incorrectly assume that it
// can infer the value of `x.1` at the end of this function.
//@ unit-test: DataflowConstProp
//@ test-mir-pass: DataflowConstProp
// EMIT_MIR sibling_ptr.main.DataflowConstProp.diff

View File

@ -1,5 +1,5 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ unit-test: DataflowConstProp
//@ test-mir-pass: DataflowConstProp
//@ compile-flags: -Zmir-enable-passes=+InstSimplify
// EMIT_MIR_FOR_EACH_BIT_WIDTH

View File

@ -1,4 +1,4 @@
//@ unit-test: DataflowConstProp
//@ test-mir-pass: DataflowConstProp
// EMIT_MIR_FOR_EACH_BIT_WIDTH
#[derive(Copy, Clone)]

View File

@ -1,5 +1,5 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ unit-test: DataflowConstProp
//@ test-mir-pass: DataflowConstProp
fn foo(n: i32) {}

View File

@ -1,4 +1,4 @@
//@ unit-test: DataflowConstProp
//@ test-mir-pass: DataflowConstProp
//@ compile-flags: -O --crate-type=lib
//@ ignore-endian-big
// EMIT_MIR_FOR_EACH_BIT_WIDTH

View File

@ -1,4 +1,4 @@
//@ unit-test: DataflowConstProp
//@ test-mir-pass: DataflowConstProp
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR tuple.main.DataflowConstProp.diff

View File

@ -1,5 +1,5 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ unit-test: DeadStoreElimination-final
//@ test-mir-pass: DeadStoreElimination-final
//@ compile-flags: -Zmir-enable-passes=+CopyProp
#![feature(core_intrinsics)]

View File

@ -2,7 +2,7 @@
// report that *all* of these stores are live.
//
//@ needs-unwind
//@ unit-test: DeadStoreElimination-initial
//@ test-mir-pass: DeadStoreElimination-initial
#![feature(core_intrinsics, custom_mir)]
use std::intrinsics::mir::*;

View File

@ -1,7 +1,7 @@
// Verify that we account for the `PlaceMention` statement as a use of the tuple,
// and don't remove it as a dead store.
//
//@ unit-test: DeadStoreElimination-initial
//@ test-mir-pass: DeadStoreElimination-initial
//@ compile-flags: -Zmir-keep-place-mention
// EMIT_MIR place_mention.main.DeadStoreElimination-initial.diff

View File

@ -1,5 +1,5 @@
// Test that we don't remove pointer to int casts or retags
//@ unit-test: DeadStoreElimination-initial
//@ test-mir-pass: DeadStoreElimination-initial
//@ compile-flags: -Zmir-emit-retag
// EMIT_MIR provenance_soundness.pointer_to_int.DeadStoreElimination-initial.diff

View File

@ -1,6 +1,6 @@
// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ unit-test: DeduplicateBlocks
//@ test-mir-pass: DeduplicateBlocks
// EMIT_MIR deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.diff
pub const fn is_line_doc_comment_2(s: &str) -> bool {

View File

@ -1,5 +1,5 @@
// skip-filecheck
//@ unit-test: Derefer
//@ test-mir-pass: Derefer
// EMIT_MIR derefer_complex_case.main.Derefer.diff
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY

View File

@ -1,5 +1,5 @@
// skip-filecheck
//@ unit-test: Derefer
//@ test-mir-pass: Derefer
// EMIT_MIR derefer_inline_test.main.Derefer.diff
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY

View File

@ -1,5 +1,5 @@
// skip-filecheck
//@ unit-test: Derefer
//@ test-mir-pass: Derefer
// EMIT_MIR derefer_terminator_test.main.Derefer.diff
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY

View File

@ -1,5 +1,5 @@
// skip-filecheck
//@ unit-test: Derefer
//@ test-mir-pass: Derefer
// EMIT_MIR derefer_test.main.Derefer.diff
fn main() {
let mut a = (42,43);

View File

@ -1,5 +1,5 @@
// skip-filecheck
//@ unit-test: Derefer
//@ test-mir-pass: Derefer
// EMIT_MIR derefer_test_multiple.main.Derefer.diff
fn main () {
let mut a = (42, 43);

View File

@ -1,7 +1,7 @@
// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//! Tests that assignment in both branches of an `if` are eliminated.
//@ unit-test: DestinationPropagation
//@ test-mir-pass: DestinationPropagation
fn val() -> i32 {
1
}

View File

@ -2,7 +2,7 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// Check that DestinationPropagation does not propagate an assignment to a function argument
// (doing so can break usages of the original argument value)
//@ unit-test: DestinationPropagation
//@ test-mir-pass: DestinationPropagation
fn dummy(x: u8) -> u8 {
x
}

Some files were not shown because too many files have changed in this diff Show More