-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add FileCheck annotations to mir-opt/copy-prop #135099
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Shunpoco <[email protected]>
Signed-off-by: Shunpoco <[email protected]>
Signed-off-by: Shunpoco <[email protected]>
Signed-off-by: Shunpoco <[email protected]>
Signed-off-by: Shunpoco <[email protected]>
Signed-off-by: Shunpoco <[email protected]>
Signed-off-by: Shunpoco <[email protected]>
Signed-off-by: Shunpoco <[email protected]>
Signed-off-by: Shunpoco <[email protected]>
Signed-off-by: Shunpoco <[email protected]>
Signed-off-by: Shunpoco <[email protected]>
Signed-off-by: Shunpoco <[email protected]>
Signed-off-by: Shunpoco <[email protected]>
Signed-off-by: Shunpoco <[email protected]>
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Mark-Simulacrum (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
dummy(x); | ||
x = 5; | ||
} | ||
|
||
// EMIT_MIR copy_propagation_arg.baz.CopyProp.diff | ||
fn baz(mut x: i32) -> i32 { | ||
// CHECK-LABEL: fn baz( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if we don't need this function for CopyProp.
I guess this test file originally from dest-prop, and in dest-prop the self-assignment is eliminated. But in copy-prop, it is not eliminated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. Do you mind fixing the comment and adding a CHECK: [[x]] = copy [[x]];
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and adding a CHECK: [[x]] = copy [[x]];?
There is no self-copy instruction in the mir file, but it has _2 = copy _1
and _0 = copy _1
(I already added).
Do you mean that I should add CHECK: _2 = copy [[x]];
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I modified it in 7a64137. Please check if the change matches with your thought 🙏
r? @cjgillot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for the great work. A few nits.
dummy(x); | ||
x = 5; | ||
} | ||
|
||
// EMIT_MIR copy_propagation_arg.baz.CopyProp.diff | ||
fn baz(mut x: i32) -> i32 { | ||
// CHECK-LABEL: fn baz( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. Do you mind fixing the comment and adding a CHECK: [[x]] = copy [[x]];
?
Signed-off-by: Shunpoco <[email protected]>
Signed-off-by: Shunpoco <[email protected]>
…-initial Signed-off-by: Shunpoco <[email protected]>
Signed-off-by: Shunpoco <[email protected]>
Signed-off-by: Shunpoco <[email protected]>
Signed-off-by: Shunpoco <[email protected]>
r? compiler |
r? @jieyouxu |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The FileCheck annotations syntactically look okay but I don't know mir-opts well so rerolling a mir-opt reviewer.
r? mir-opt |
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY | ||
// 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. | ||
|
||
//@ test-mir-pass: CopyProp | ||
//@ compile-flags: -Zmir-enable-passes=+DeadStoreElimination | ||
//@ compile-flags: -Zmir-enable-passes=+DeadStoreElimination-initial |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currious why the change here? The CHECK statements look identical to those in dead_stores_79191.rs
which makes the comment above outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Now I confirmed that mir files from those tests are identical.
They were introduced in #106908, but in the PR the .f.CopyProp.after.mir
files already looked identical.
Should we remove this test as duplicated test?
This resolves a part of #116971 .
This PR adds FileCheck annotations to test files under mir-opt/copy-prop.