Skip to content

Commit a781d64

Browse files
committed
Add README.
1 parent abbc165 commit a781d64

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/mir-opt/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,19 @@ This exists mainly for completeness and is rarely useful.
4949
```
5050
// EMIT_MIR $file_name_of_some_mir_dump.before.mir
5151
```
52+
53+
# FileCheck directives
54+
55+
The LLVM FileCheck tool is used to verify the contents of output MIR against `CHECK` directives
56+
present in the test file. This works on the runtime MIR, generated by `--emit=mir`, and not
57+
on the output of a individual passes.
58+
59+
To check MIR for function `foo`, start with a `// CHECK-LABEL fn foo(` directive.
60+
61+
`{{regex}}` syntax allows to match `regex`.
62+
63+
`[[name:regex]]` syntax allows to bind `name` to a string matching `regex`, and refer to it
64+
as `[[name]]` in later directives, `regex` should be written not to match a leading space.
65+
Use `[[my_local:_.*]]` to name a local, and `[[my_bb:bb.*]]` to name a block.
66+
67+
Documentation for FileCheck is available here: https://www.llvm.org/docs/CommandGuide/FileCheck.html

0 commit comments

Comments
 (0)