| author | bors <bors@rust-lang.org> 2026-06-27 23:22:55 UTC |
| committer | bors <bors@rust-lang.org> 2026-06-27 23:22:55 UTC |
| log | 8b95a26baf5820929d86a844317160905e7b325b |
| tree | 4701ea10b2907d5a304c48417c56f913c20ff060 |
| parent | 13f1859f2faf97a15664e655624baa7417fdc100 |
| parent | 96bf9d674be7b8867999840cc1eb7a17bd0ceb4c |
Revert "LLVM 23: Adapt codegen test to moved assume"
This reverts https://github.com/rust-lang/rust/pull/158067.
Fixes https://github.com/rust-lang/rust/issues/158500
The fix that was applied here is not robust against layout randomization, specifically the IR to load through the slice head pointer needs to come after a gepi, and not just a `load ptr, ptr %x`.
Based on the PR discussion, I think it's possible that the `min-llvm-version: 22` was mistakenly added when CI happened to choose the bad layout during the initial merge.
I'm not yet sure what the right fix is, but this is causing about half of all merges to fail right now so a revert seems prudent.
I don't think we have a way to skip tests when randomize-layout is set. The problem here is that we run codegen tests against the globally-configured sysroot, so setting `-Zrandomize-layout` in the test doesn't do anything.1 files changed, 5 insertions(+), 5 deletions(-)
tests/codegen-llvm/issues/issue-107681-unwrap_unchecked.rs+5-5| ... | ... | @@ -1,6 +1,4 @@ |
| 1 | 1 | //@ compile-flags: -Copt-level=3 |
| 2 | //@ filecheck-flags: --implicit-check-not 'br {{.*}}' --implicit-check-not 'select' | |
| 3 | //@ min-llvm-version: 22 | |
| 4 | 2 | |
| 5 | 3 | // Test for #107681. |
| 6 | 4 | // Make sure we don't create `br` or `select` instructions. |
| ... | ... | @@ -13,8 +11,10 @@ use std::slice::Iter; |
| 13 | 11 | #[no_mangle] |
| 14 | 12 | pub unsafe fn foo(x: &mut Copied<Iter<'_, u32>>) -> u32 { |
| 15 | 13 | // CHECK-LABEL: @foo( |
| 16 | // CHECK: [[INNER:%.*]] = load ptr, ptr %x | |
| 17 | // CHECK: [[RET:%.*]] = load i32, ptr [[INNER]] | |
| 18 | // CHECK: ret i32 [[RET]] | |
| 14 | // CHECK-NOT: br {{.*}} | |
| 15 | // CHECK-NOT: select | |
| 16 | // CHECK: [[RET:%.*]] = load i32, ptr | |
| 17 | // CHECK-NEXT: assume | |
| 18 | // CHECK-NEXT: ret i32 [[RET]] | |
| 19 | 19 | x.next().unwrap_unchecked() |
| 20 | 20 | } |