mirror of
https://github.com/allankoechke/rust.git
synced 2026-12-01 01:26:32 +00:00
LLVM 23: Adapt codegen test to moved assume I wasn't completely sure what the important part of this test is - based on the "Make sure we don't create `br` or `select` instructions" comment I assume it's that the `load` is followed ~immediately by the `ret`, and that the presence or absence of the `assume` doesn't really matter (it's been moved up a few lines to before the `load`): ```ll ; Function Attrs define noundef i32 @foo(ptr noalias nofree noundef align 8 captures(none) dereferenceable(16) %x) unnamed_addr #0 { start %_6 = load ptr, ptr %x, align 8, !nonnull !4, !noundef !4 %0 = getelementptr inbounds nuw i8, ptr %x, i64 8 %_7 = load ptr, ptr %0, align 8, !nonnull !4, !noundef !4 %_8 = icmp ne ptr %_6, %_7 tail call void @llvm.assume(i1 %_8) %_14 = getelementptr inbounds nuw i8, ptr %_6, i64 4 store ptr %_14, ptr %x, align 8 %_4 = load i32, ptr %_6, align 4, !noundef !4 ret i32 %_4 } ``` @rustbot label llvm-main [original CI failure](https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/46608/list?sid=019ed950-c81f-466d-a3bc-2064e6a26719&tab=output)
The files here use the LLVM FileCheck framework, documented at https://llvm.org/docs/CommandGuide/FileCheck.html.
One extension worth noting is the use of revisions as custom prefixes for FileCheck. If your codegen test has different behavior based on the chosen target or different compiler flags that you want to exercise, you can use a revisions annotation, like so:
// revisions: aaa bbb
// [bbb] compile-flags: --flags-for-bbb
After specifying those variations, you can write different expected, or
explicitly unexpected output by using <prefix>-SAME: and <prefix>-NOT:,
like so:
// CHECK: expected code
// aaa-SAME: emitted-only-for-aaa
// aaa-NOT: emitted-only-for-bbb
// bbb-NOT: emitted-only-for-aaa
// bbb-SAME: emitted-only-for-bbb