]> git.lizzy.rs Git - rust.git/blob - src/test/mir-opt/README.md
Rollup merge of #100240 - cjgillot:noice-structural-match, r=davidtwco
[rust.git] / src / test / mir-opt / README.md
1 This folder contains tests for MIR optimizations.
2
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
10
11 ```
12 // EMIT_MIR_FOR_EACH_BIT_WIDTH
13 ```
14
15 to your test, causing separate files to be generated for 32bit and 64bit systems.
16
17 ## Emit a diff of the mir for a specific optimization
18
19 This is what you want most often when you want to see how an optimization changes the MIR.
20
21 ```
22 // EMIT_MIR $file_name_of_some_mir_dump.diff
23 ```
24
25 ## Emit mir after a specific optimization
26
27 Use this if you are just interested in the final state after an optimization.
28
29 ```
30 // EMIT_MIR $file_name_of_some_mir_dump.after.mir
31 ```
32
33 ## Emit mir before a specific optimization
34
35 This exists mainly for completeness and is rarely useful.
36
37 ```
38 // EMIT_MIR $file_name_of_some_mir_dump.before.mir
39 ```