Add FileCheck annotations to 5 MIR-opt tests#153147
Open
sivadeilra wants to merge 1 commit intorust-lang:mainfrom
Open
Add FileCheck annotations to 5 MIR-opt tests#153147sivadeilra wants to merge 1 commit intorust-lang:mainfrom
sivadeilra wants to merge 1 commit intorust-lang:mainfrom
Conversation
This comment has been minimized.
This comment has been minimized.
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
60ad693 to
bf43e31
Compare
cjgillot
reviewed
Mar 1, 2026
| } | ||
| fn main() { | ||
| // CHECK-LABEL: fn main( | ||
| // CHECK-NOT: deref_copy |
Contributor
There was a problem hiding this comment.
A single CHECK-NOT can be very brittle. Do you mind adding some positive CHECKs?
| //@ compile-flags: -Zmir-opt-level=1 -Zinline-mir | ||
| pub fn f<T>(a: &T) -> *const T { | ||
| // CHECK-LABEL: fn f( | ||
| // CHECK: &raw const (*_1) |
Contributor
There was a problem hiding this comment.
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.
| @@ -1,8 +1,11 @@ | |||
| // skip-filecheck | |||
| //@ compile-flags: -Z mir-opt-level=4 | |||
Contributor
There was a problem hiding this comment.
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 |
Contributor
|
Thank you very much for continuing this. This is also an opportunity to cleanup the mir-opt test suite, which is why some comments discuss more than just the FileCheck annotations. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add FileCheck annotations to 5 MIR-opt tests that previously used
// skip-filecheckChanges
byte_slice.rsb"foo"and byte array[5u8, b'x']appear in MIRmultiple_return_terminators.rsfn testcollapses to a singlebb0: { return; }impossible_predicates.rs&mut i32: Copy) becomesbb0: { unreachable; }lower_array_len.rs.len()lowered toconst N, bounds checks useLt(_, const N)remove_zsts.rsconst ZeroSizedAll annotations follow the patterns established in existing annotated tests (e.g.,
simd-intrinsic-mask-reduce.rs). Each usesCHECK-LABELto anchor on the function, thenCHECK/CHECK-NOT/CHECK-NEXTto verify the key optimization results.r? cjgillot