]>
git.proxmox.com Git - rustc.git/blob - src/test/codegen/issue-37945.rs
1 // compile-flags: -O -Zmerge-functions=disabled
6 // ignore 32-bit platforms (LLVM has a bug with them)
8 // Check that LLVM understands that `Iter` pointer is not null. Issue #37945.
10 #![crate_type = "lib"]
15 pub fn is_empty_1(xs
: Iter
<f32>) -> bool
{
16 // CHECK-LABEL: @is_empty_1(
18 // CHECK-NEXT: [[A:%.*]] = icmp ne {{i32\*|ptr}} %xs.1, null
19 // CHECK-NEXT: tail call void @llvm.assume(i1 [[A]])
20 // CHECK-NEXT: [[B:%.*]] = icmp eq {{i32\*|ptr}} %xs.0, %xs.1
21 // CHECK-NEXT: ret i1 [[B:%.*]]
26 pub fn is_empty_2(xs
: Iter
<f32>) -> bool
{
27 // CHECK-LABEL: @is_empty_2
29 // CHECK-NEXT: [[C:%.*]] = icmp ne {{i32\*|ptr}} %xs.1, null
30 // CHECK-NEXT: tail call void @llvm.assume(i1 [[C]])
31 // CHECK-NEXT: [[D:%.*]] = icmp eq {{i32\*|ptr}} %xs.0, %xs.1
32 // CHECK-NEXT: ret i1 [[D:%.*]]
33 xs
.map(|&x
| x
).next().is_none()