]>
Commit | Line | Data |
---|---|---|
5bcae85e SL |
1 | This folder contains tests for MIR optimizations. |
2 | ||
ba9703b0 XL |
3 | The `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 | ||
8 | By default 32 bit and 64 bit targets use the same dump files, which can be problematic in the | |
9 | presence 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 | 15 | to 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 | 19 | This 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 | 27 | Use 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 | 35 | This 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 | ``` |