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

Mention unit-test in MIR opt test README #100314

Merged
merged 1 commit into from
Aug 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/test/mir-opt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ presence of pointers in constants or other bit width dependent things. In that c

to your test, causing separate files to be generated for 32bit and 64bit systems.

## Unit testing

If you are only testing the behavior of a particular mir-opt pass on some specific input (as is
usually the case), you should add

```
// unit-test: PassName
```

to the top of the file. This makes sure that other passes don't run which means you'll get the input
you expected and your test won't break when other code changes.

## Emit a diff of the mir for a specific optimization

This is what you want most often when you want to see how an optimization changes the MIR.
Expand Down