]>
Commit | Line | Data |
---|---|---|
dc9dc135 XL |
1 | // no-system-llvm |
2 | // compile-flags: -O | |
2b03887a | 3 | // ignore-debug: the debug assertions add extra comparisons |
dc9dc135 XL |
4 | #![crate_type = "lib"] |
5 | ||
6 | type Demo = [u8; 3]; | |
7 | ||
8 | // CHECK-LABEL: @slice_iter_len_eq_zero | |
9 | #[no_mangle] | |
10 | pub fn slice_iter_len_eq_zero(y: std::slice::Iter<'_, Demo>) -> bool { | |
11 | // CHECK-NOT: sub | |
923072b8 | 12 | // CHECK: %2 = icmp eq {{i8\*|ptr}} %1, %0 |
dc9dc135 XL |
13 | // CHECK: ret i1 %2 |
14 | y.len() == 0 | |
15 | } | |
2b03887a FG |
16 | |
17 | // CHECK-LABEL: @array_into_iter_len_eq_zero | |
18 | #[no_mangle] | |
19 | pub fn array_into_iter_len_eq_zero(y: std::array::IntoIter<Demo, 123>) -> bool { | |
20 | // This should be able to just check that the indexes are equal, and not | |
21 | // need any subtractions or comparisons to handle `start > end`. | |
22 | ||
23 | // CHECK-NOT: icmp | |
24 | // CHECK-NOT: sub | |
25 | // CHECK: %1 = icmp eq {{i16|i32|i64}} | |
26 | // CHECK: ret i1 %1 | |
27 | y.len() == 0 | |
28 | } |