Skip to content

Commit 13a73ca

Browse files
committed
Document FileCheck mode
1 parent f57f503 commit 13a73ca

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

guide/src/tutorial.md

+21
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,27 @@ cargo bisect-rustc --script=./test.sh \
136136
[issue #53157]: https://github.com/rust-lang/rust/issues/53157
137137
[issue #55036]: https://github.com/rust-lang/rust/issues/55036
138138

139+
## Testing with LLVM FileCheck
140+
141+
If you want to investigate a regression in codegen, you can use LLVM's FileCheck. You can write a library containing FileCheck annotations:
142+
143+
```rs
144+
// CHECK-LABEL: @wildcard(
145+
#[no_mangle]
146+
pub fn wildcard(a: u16, b: u16, v: u16) -> u16 {
147+
// CHECK-NOT: br
148+
match (a == v, b == v) {
149+
(true, false) => 0,
150+
(false, true) => u16::MAX,
151+
_ => 1 << 15, // half
152+
}
153+
}
154+
```
155+
156+
To investigate when `br` stopped being emitted, you can use `cargo-bisect-rustc --start 1.70.0 --filecheck src/lib.rs --preserve --regress success`.
157+
158+
By default, this will compile with `cargo rustc -- -Copt-level=3 -Cdebuginfo=0 --emit=llvm-ir=<target dir>/debug/deps/output.ll`.
159+
139160
## Custom bisection messages
140161

141162
*Available from v0.6.9*

0 commit comments

Comments
 (0)