Skip to content

Commit 07f2ebb

Browse files
authored
Rollup merge of #154731 - maurer:array-abi-test, r=scottmcm
llvm: Fix array ABI test to not check equality implementation LLVM has moved memcmp expansion in the pipeline, resulting in the bcmp call being expanded into loads and register comparisons, which breaks the test. See llvm/llvm-project#77370 Based on history, I believe the test actually intended validate that these arrays were being passed as pointer arguments, which can be done more directly. r? @durin42 cc @scottmcm (author of the test being modified) @rustbot label llvm-main
2 parents 643f45e + d6be991 commit 07f2ebb

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

tests/codegen-llvm/array-equality.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//@ revisions: llvm-current llvm-next
2+
//@[llvm-current] ignore-llvm-version: 23-99
3+
//@[llvm-next] min-llvm-version: 23
14
//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled
25
//@ only-x86_64
36
#![crate_type = "lib"]
@@ -26,9 +29,18 @@ pub fn array_eq_ref(a: &[u16; 3], b: &[u16; 3]) -> bool {
2629
#[no_mangle]
2730
pub fn array_eq_value_still_passed_by_pointer(a: [u16; 9], b: [u16; 9]) -> bool {
2831
// CHECK-NEXT: start:
29-
// CHECK: %[[CMP:.+]] = tail call i32 @{{bcmp|memcmp}}(ptr {{.*}} dereferenceable(18) %{{.+}}, ptr {{.*}} dereferenceable(18) %{{.+}}, i64 18)
30-
// CHECK-NEXT: %[[EQ:.+]] = icmp eq i32 %[[CMP]], 0
31-
// CHECK-NEXT: ret i1 %[[EQ]]
32+
// CHECK-NOT: alloca
33+
// llvm-current-NEXT: %[[CMP:.+]] = tail call i32 @{{bcmp|memcmp}}(ptr
34+
// llvm-current-SAME: {{.*}} dereferenceable(18) %{{.+}}, ptr {{.*}} dereferenceable(18)
35+
// llvm-current-SAME: %{{.+}}, i64 18)
36+
// llvm-current-NEXT: %[[EQ:.+]] = icmp eq i32 %[[CMP]], 0
37+
// llvm-current-NEXT: ret i1 %[[EQ]]
38+
// CHECK-NOT: call
39+
// New LLVM expands the bcmp earlier, so this becomes wide reads + icmp
40+
// No allocas or calls, and at least one icmp
41+
// llvm-next: icmp
42+
// CHECK-NOT: alloca
43+
// CHECK-NOT: call
3244
a == b
3345
}
3446

0 commit comments

Comments
 (0)