summaryrefslogtreecommitdiffstats
path: root/src/test/mir-opt/README.md
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /src/test/mir-opt/README.md
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/mir-opt/README.md')
-rw-r--r--src/test/mir-opt/README.md39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/test/mir-opt/README.md b/src/test/mir-opt/README.md
new file mode 100644
index 000000000..a0550466c
--- /dev/null
+++ b/src/test/mir-opt/README.md
@@ -0,0 +1,39 @@
+This folder contains tests for MIR optimizations.
+
+The `mir-opt` test format emits MIR to extra files that you can automatically update by specifying
+`--bless` on the command line (just like `ui` tests updating `.stderr` files).
+
+# `--bless`able test format
+
+By default 32 bit and 64 bit targets use the same dump files, which can be problematic in the
+presence of pointers in constants or other bit width dependent things. In that case you can add
+
+```
+// EMIT_MIR_FOR_EACH_BIT_WIDTH
+```
+
+to your test, causing separate files to be generated for 32bit and 64bit systems.
+
+## 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.
+
+```
+// EMIT_MIR $file_name_of_some_mir_dump.diff
+```
+
+## Emit mir after a specific optimization
+
+Use this if you are just interested in the final state after an optimization.
+
+```
+// EMIT_MIR $file_name_of_some_mir_dump.after.mir
+```
+
+## Emit mir before a specific optimization
+
+This exists mainly for completeness and is rarely useful.
+
+```
+// EMIT_MIR $file_name_of_some_mir_dump.before.mir
+```