Skip to content

Add FileCheck annotations to MIR-opt tests #116971

Open
@cjgillot

Description

The MIR-opt testsuite (tests/mir-opt) supports checking the MIR output using LLVM FileCheck tool. The purpose of this check is to write in the .rs file what we expect to see, similar to the annotations we have for ui tests. See individual commits in #116810 for a few examples, and tests/mir-opt/README.md for tips in dealing with functions, locals and basic blocks.

Most testcases disable this using a // skip-filecheck comment. They should not.
We need to go through all the test cases in the MIR-opt suite to write these annotations.
Exception: the tests/mir-opt/pre-codegen does not need these directives, as its purpose is to track the quality of the MIR we emit.

Steps, for each test case:

  • figure out what is being tested (that's sometimes not directly obvious, may need git archeology);
  • write the FileCheck annotations based on the emitted MIR (see the MIR dumps to help).

In some cases, it may be interesting to strengthen the test cases to better verify what they meant to verify. This can be done by adding a // unit-test: SomePassName directive at the top, or changing compiler flags.

The point is to add check directives for what we want to check. Skipping storage statements, basic-block numbers, useless assignments is encouraged.

For volunteers: please post a comment with the files you want to work with. Please do not claim the whole issue, there is plenty to do. Please r? cjgillot in the PR so I can keep track of them.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-mir-optArea: MIR optimizationsA-testsuiteArea: The testsuite used to check the correctness of rustcE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-help-wantedCall for participation: Help is requested to fix this issue.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.E-tediousCall for participation: An issue involves lots of work and is better handled as many small tasks.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions