Skip to content

Commit 107d7ef

Browse files
committed
test(codegen): add looping_over_ne_bytes test for #133528
1 parent 2874876 commit 107d7ef

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Diff for: tests/codegen/issues/looping-over-ne-bytes-133528.rs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//@ compile-flags: -Copt-level=3
2+
//@ min-llvm-version: 20
3+
#![crate_type = "lib"]
4+
5+
/// Ensure the function is properly optimized
6+
/// In the issue #133528, the function was not getting optimized
7+
/// whereas, a version with `bytes` wrapped into a `black_box` was optimized
8+
/// It was probably a LLVM bug that was fixed in LLVM 20
9+
10+
// CHECK-LABEL: @looping_over_ne_bytes
11+
// CHECK: icmp eq i64 %input, -1
12+
// CHECK-NEXT: ret i1
13+
#[no_mangle]
14+
fn looping_over_ne_bytes(input: u64) -> bool {
15+
let bytes = input.to_ne_bytes();
16+
bytes.iter().all(|x| *x == !0)
17+
}

0 commit comments

Comments
 (0)