Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion tests/mir-opt/byte_slice.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// skip-filecheck
//@ compile-flags: -Z mir-opt-level=0

// EMIT_MIR byte_slice.main.SimplifyCfg-pre-optimizations.after.mir
fn main() {
// CHECK-LABEL: fn main(
// CHECK: = const b"foo"
// CHECK: = [const 5_u8, const 120_u8]
let x = b"foo";
let y = [5u8, b'x'];
}
3 changes: 2 additions & 1 deletion tests/mir-opt/derefer_inline_test.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// skip-filecheck
//@ test-mir-pass: Derefer
// EMIT_MIR derefer_inline_test.main.Derefer.diff
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
Expand All @@ -8,5 +7,7 @@ fn f() -> Box<u32> {
Box::new(0)
}
fn main() {
// CHECK-LABEL: fn main(
// CHECK-NOT: deref_copy
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A single CHECK-NOT can be very brittle. Do you mind adding some positive CHECKs?

Box::new(f());
}
5 changes: 4 additions & 1 deletion tests/mir-opt/impossible_predicates.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
// skip-filecheck
// EMIT_MIR impossible_predicates.impossible_predicate.ImpossiblePredicates.diff

pub fn impossible_predicate(x: &mut i32) -> (&mut i32, &mut i32)
where
for<'a> &'a mut i32: Copy,
{
// CHECK-LABEL: fn impossible_predicate(
// CHECK: bb0: {
// CHECK-NEXT: unreachable;
// CHECK-NEXT: }
let y = x;
(y, x)
}
3 changes: 2 additions & 1 deletion tests/mir-opt/issue_78192.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// skip-filecheck
//@ compile-flags: -Zmir-opt-level=1 -Zinline-mir
pub fn f<T>(a: &T) -> *const T {
// CHECK-LABEL: fn f(
// CHECK: &raw const (*_1)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not what the PR introducing this test was aiming for. If you look at 57d01a9aeea5, we are testing that _0 = (*_2) does not become _0 = (*_3), as _3 has no storage at that statement.

let b: &*const T = &(a as *const T);
*b
}
Expand Down
5 changes: 4 additions & 1 deletion tests/mir-opt/multiple_return_terminators.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// skip-filecheck
//@ compile-flags: -Z mir-opt-level=4
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file does not test what it's meant to test. Do you mind changing this line to the following? We should get two return; statements in the MIR for test.

Suggested change
//@ compile-flags: -Z mir-opt-level=4
//@ test-mir-pass: MultipleReturnTerminators

// EMIT_MIR multiple_return_terminators.test.MultipleReturnTerminators.diff

fn test(x: bool) {
// CHECK-LABEL: fn test(
// CHECK: bb0: {
// CHECK-NEXT: return;
// CHECK-NEXT: }
if x {
// test
} else {
Expand Down
Loading