Skip to content

Commit d54ea4f

Browse files
committed
Fix codegen test for issue 37945
1 parent 28463aa commit d54ea4f

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/test/codegen/issue-37945.rs

+14-6
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,34 @@
1-
// compile-flags: -O
1+
// compile-flags: -O -Zmerge-functions=disabled
22
// ignore-x86
33
// ignore-arm
44
// ignore-emscripten
55
// ignore-gnux32
66
// ignore 32-bit platforms (LLVM has a bug with them)
77

8-
// See issue #37945.
8+
// Check that LLVM understands that `Iter` pointer is not null. Issue #37945.
99

1010
#![crate_type = "lib"]
1111

1212
use std::slice::Iter;
1313

14-
// CHECK-LABEL: @is_empty_1
1514
#[no_mangle]
1615
pub fn is_empty_1(xs: Iter<f32>) -> bool {
17-
// CHECK-NOT: icmp eq float* {{.*}}, null
16+
// CHECK-LABEL: @is_empty_1(
17+
// CHECK-NEXT: start:
18+
// CHECK-NEXT: [[A:%.*]] = icmp ne i32* %xs.1, null
19+
// CHECK-NEXT: tail call void @llvm.assume(i1 [[A]])
20+
// CHECK-NEXT: [[B:%.*]] = icmp eq i32* %xs.0, %xs.1
21+
// CHECK-NEXT: ret i1 [[B:%.*]]
1822
{xs}.next().is_none()
1923
}
2024

21-
// CHECK-LABEL: @is_empty_2
2225
#[no_mangle]
2326
pub fn is_empty_2(xs: Iter<f32>) -> bool {
24-
// CHECK-NOT: icmp eq float* {{.*}}, null
27+
// CHECK-LABEL: @is_empty_2
28+
// CHECK-NEXT: start:
29+
// CHECK-NEXT: [[C:%.*]] = icmp ne i32* %xs.1, null
30+
// CHECK-NEXT: tail call void @llvm.assume(i1 [[C]])
31+
// CHECK-NEXT: [[D:%.*]] = icmp eq i32* %xs.0, %xs.1
32+
// CHECK-NEXT: ret i1 [[D:%.*]]
2533
xs.map(|&x| x).next().is_none()
2634
}

0 commit comments

Comments
 (0)