]> git.proxmox.com Git - rustc.git/blame - src/test/mir-opt/README.md
New upstream version 1.44.1+dfsg1
[rustc.git] / src / test / mir-opt / README.md
CommitLineData
5bcae85e
SL
1This folder contains tests for MIR optimizations.
2
ba9703b0
XL
3The `mir-opt` test format emits MIR to extra files that you can automatically update by specifying
4`--bless` on the command line (just like `ui` tests updating `.stderr` files).
5
6# `--bless`able test format
7
8By default 32 bit and 64 bit targets use the same dump files, which can be problematic in the
9presence of pointers in constants or other bit width dependent things. In that case you can add
5bcae85e
SL
10
11```
ba9703b0 12// EMIT_MIR_FOR_EACH_BIT_WIDTH
5bcae85e
SL
13```
14
ba9703b0 15to your test, causing separate files to be generated for 32bit and 64bit systems.
5bcae85e 16
ba9703b0 17## Emit a diff of the mir for a specific optimization
abe05a73 18
ba9703b0 19This is what you want most often when you want to see how an optimization changes the MIR.
041b39d2
XL
20
21```
ba9703b0 22// EMIT_MIR $file_name_of_some_mir_dump.diff
041b39d2
XL
23```
24
ba9703b0 25## Emit mir after a specific optimization
5bcae85e 26
ba9703b0 27Use this if you are just interested in the final state after an optimization.
abe05a73
XL
28
29```
ba9703b0 30// EMIT_MIR $file_name_of_some_mir_dump.after.mir
abe05a73
XL
31```
32
ba9703b0 33## Emit mir before a specific optimization
5bcae85e 34
ba9703b0 35This exists mainly for completeness and is rarely useful.
5bcae85e 36
ba9703b0
XL
37```
38// EMIT_MIR $file_name_of_some_mir_dump.before.mir
39```