Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e76cb8c

Browse files
committedOct 19, 2023
Auto merge of #116810 - cjgillot:mir-opt-check, r=oli-obk
Add FileCheck annotations to mir-opt tests. This PR makes compiletest run LLVM `FileCheck` tool on mir-opt tests. The check is *run by default*, except if disabled using `// skip-filecheck` comment. This ensures that we do not have a silently broken test. For now, the check is only run on the output of `--emit=mir`, ie. on PreCodegen MIR. I give an example on `reference_prop.rs`. r? `@oli-obk` cc `@RalfJung` Fixes #85180
2 parents c104861 + 328192b commit e76cb8c

File tree

353 files changed

+1444
-589
lines changed

Some content is hidden

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

353 files changed

+1444
-589
lines changed
 

‎tests/mir-opt/address_of.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// skip-filecheck
12
// EMIT_MIR address_of.address_of_reborrow.SimplifyCfg-initial.after.mir
23

34
fn address_of_reborrow() {

‎tests/mir-opt/array_index_is_temporary.rs

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// unit-test: SimplifyCfg-elaborate-drops
12
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
23
// Retagging (from Stacked Borrows) relies on the array index being a fresh
34
// temporary, so that side-effects cannot change it.
@@ -11,6 +12,12 @@ unsafe fn foo(z: *mut usize) -> u32 {
1112

1213
// EMIT_MIR array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.mir
1314
fn main() {
15+
// CHECK-LABEL: fn main(
16+
// CHECK: debug x => [[x:_.*]];
17+
// CHECK: debug y => [[y:_.*]];
18+
// CHECK: [[y]] = const 1_usize;
19+
// CHECK: [[tmp:_.*]] = [[y]];
20+
// CHECK: [[x]][[[tmp]]] =
1421
let mut x = [42, 43, 44];
1522
let mut y = 1;
1623
let z: *mut usize = &mut y;
There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Failed to load comments.