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 // The order between %xs.0 and %xs.1 on the next line doesn't matter
21 // and different LLVM versions produce different order.
22 // CHECK-NEXT: [[B:%.*]] = icmp eq {{i32\*|ptr}} {{%xs.0, %xs.1|%xs.1, %xs.0}}
23 // CHECK-NEXT: ret i1 [[B:%.*]]
28 pub fn is_empty_2(xs: Iter<f32>) -> bool {
29 // CHECK-LABEL: @is_empty_2
31 // CHECK-NEXT: [[C:%.*]] = icmp ne {{i32\*|ptr}} %xs.1, null
32 // CHECK-NEXT: tail call void @llvm.assume(i1 [[C]])
33 // The order between %xs.0 and %xs.1 on the next line doesn't matter
34 // and different LLVM versions produce different order.
35 // CHECK-NEXT: [[D:%.*]] = icmp eq {{i32\*|ptr}} {{%xs.0, %xs.1|%xs.1, %xs.0}}
36 // CHECK-NEXT: ret i1 [[D:%.*]]
37 xs.map(|&x| x).next().is_none()