1 This folder contains tests for MIR optimizations.
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).
6 # `--bless`able test format
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
12 // EMIT_MIR_FOR_EACH_BIT_WIDTH
15 to your test, causing separate files to be generated for 32bit and 64bit systems.
19 If you are only testing the behavior of a particular mir-opt pass on some specific input (as is
20 usually the case), you should add
23 // unit-test: PassName
26 to the top of the file. This makes sure that other passes don't run which means you'll get the input
27 you expected and your test won't break when other code changes.
29 ## Emit a diff of the mir for a specific optimization
31 This is what you want most often when you want to see how an optimization changes the MIR.
34 // EMIT_MIR $file_name_of_some_mir_dump.diff
37 ## Emit mir after a specific optimization
39 Use this if you are just interested in the final state after an optimization.
42 // EMIT_MIR $file_name_of_some_mir_dump.after.mir
45 ## Emit mir before a specific optimization
47 This exists mainly for completeness and is rarely useful.
50 // EMIT_MIR $file_name_of_some_mir_dump.before.mir