Skip to content
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

crashes: add test for #131451 #133104

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

matthiaskrgr
Copy link
Member

r? @saethlin
How do I find out which mir opts are involved here? 😅

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 16, 2024
@saethlin
Copy link
Member

This should be scriptable:

First off, try with a lower mir-opt-level. This is just a fast way to trim down the pass list.

Build with -Zdump-mir=all. This will produce a mir_dump directory that has the before and after MIR for every pass that was run on any MIR. This produces a directory called mir_dump/ which contains a bunch of files named like <crate>.<function>.<phase_number>-<pass_number>.<pass_name>.{before,after}.mir.

You should be able to manually enable only the passes that produce a diff in the MIR. The before and after files always differ on the first line because that's a comment that repeats the file's name.

Then trim down that list of passes further, if possible.

@saethlin saethlin added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 20, 2024
@matthiaskrgr
Copy link
Member Author

matthiaskrgr commented Nov 21, 2024

ok ty, I think I got it :D
to get the flags, in the mir-dump dir:

ls -c1 | sort -n | grep after  | grep -o "...-...\..*.after" | cut -c9- | sed 's/\.after$//g'   | sed s/^/\"-Zmir-enable-passes=+/  | sed -e s/$/\",/

Then I throw this into icemaker and let it reduce the flags automatically:
-Zvalidate-mir -Zmir-enable-passes=+DataflowConstProp -Zmir-enable-passes=+Inline
oops these were from a different file that does not require debug assertions
edit: this is

-Clink-dead-code=true -Zmir-enable-passes=+GVN -Zmir-enable-passes=+JumpThreading --crate-type=lib

@saethlin
Copy link
Member

Can you drop -Clink-dead-code=true if the fn is pub?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants