Skip to content

Commit bf43e31

Browse files
committed
Add FileCheck annotations to 5 mir-opt tests
Remove skip-filecheck and add FileCheck directives for: - multiple_return_terminators.rs: verify pass collapses to single bb0 with return - impossible_predicates.rs: verify body becomes unreachable when predicates impossible - byte_slice.rs: verify byte slice literal lowering in MIR - lower_array_len.rs: verify array .len() lowered to const N by GVN - remove_zsts.rs: verify zero-sized types replaced with const ZeroSized
1 parent 1ed4882 commit bf43e31

5 files changed

Lines changed: 15 additions & 5 deletions

File tree

tests/mir-opt/byte_slice.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
// skip-filecheck
21
//@ compile-flags: -Z mir-opt-level=0
32

43
// EMIT_MIR byte_slice.main.SimplifyCfg-pre-optimizations.after.mir
54
fn main() {
5+
// CHECK-LABEL: fn main(
6+
// CHECK: = const b"foo"
7+
// CHECK: = [const 5_u8, const 120_u8]
68
let x = b"foo";
79
let y = [5u8, b'x'];
810
}

tests/mir-opt/derefer_inline_test.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// skip-filecheck
21
//@ test-mir-pass: Derefer
32
// EMIT_MIR derefer_inline_test.main.Derefer.diff
43
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
@@ -8,5 +7,7 @@ fn f() -> Box<u32> {
87
Box::new(0)
98
}
109
fn main() {
10+
// CHECK-LABEL: fn main(
11+
// CHECK-NOT: deref_copy
1112
Box::new(f());
1213
}
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
// skip-filecheck
21
// EMIT_MIR impossible_predicates.impossible_predicate.ImpossiblePredicates.diff
32

43
pub fn impossible_predicate(x: &mut i32) -> (&mut i32, &mut i32)
54
where
65
for<'a> &'a mut i32: Copy,
76
{
7+
// CHECK-LABEL: fn impossible_predicate(
8+
// CHECK: bb0: {
9+
// CHECK-NEXT: unreachable;
10+
// CHECK-NEXT: }
811
let y = x;
912
(y, x)
1013
}

tests/mir-opt/issue_78192.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
// skip-filecheck
21
//@ compile-flags: -Zmir-opt-level=1 -Zinline-mir
32
pub fn f<T>(a: &T) -> *const T {
3+
// CHECK-LABEL: fn f(
4+
// CHECK: &raw const (*_1)
45
let b: &*const T = &(a as *const T);
56
*b
67
}

tests/mir-opt/multiple_return_terminators.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
// skip-filecheck
21
//@ compile-flags: -Z mir-opt-level=4
32
// EMIT_MIR multiple_return_terminators.test.MultipleReturnTerminators.diff
43

54
fn test(x: bool) {
5+
// CHECK-LABEL: fn test(
6+
// CHECK: bb0: {
7+
// CHECK-NEXT: return;
8+
// CHECK-NEXT: }
69
if x {
710
// test
811
} else {

0 commit comments

Comments
 (0)