File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change 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
1212use std:: slice:: Iter ;
1313
14- // CHECK-LABEL: @is_empty_1
1514#[ no_mangle]
1615pub 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]
2326pub 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}
You can’t perform that action at this time.
0 commit comments