diff options
Diffstat (limited to '')
-rw-r--r-- | tests/mir-opt/README.md | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/mir-opt/README.md b/tests/mir-opt/README.md index 0721d9f70..39a7b5aea 100644 --- a/tests/mir-opt/README.md +++ b/tests/mir-opt/README.md @@ -49,3 +49,21 @@ This exists mainly for completeness and is rarely useful. ``` // EMIT_MIR $file_name_of_some_mir_dump.before.mir ``` + +# FileCheck directives + +The LLVM FileCheck tool is used to verify the contents of output MIR against `CHECK` directives +present in the test file. This works on the runtime MIR, generated by `--emit=mir`, and not +on the output of a individual passes. + +Use `// skip-filecheck` to prevent FileCheck from running. + +To check MIR for function `foo`, start with a `// CHECK-LABEL fn foo(` directive. + +`{{regex}}` syntax allows to match `regex`. + +`[[name:regex]]` syntax allows to bind `name` to a string matching `regex`, and refer to it +as `[[name]]` in later directives, `regex` should be written not to match a leading space. +Use `[[my_local:_.*]]` to name a local, and `[[my_bb:bb.*]]` to name a block. + +Documentation for FileCheck is available here: https://www.llvm.org/docs/CommandGuide/FileCheck.html |