add codegen test for slice::Iter::fold

This commit is contained in:
The 8472 2023-06-12 14:05:46 +02:00
parent d89e458159
commit ba5b2f0b4b

View File

@ -0,0 +1,14 @@
// ignore-debug: the debug assertions get in the way
// compile-flags: -O
// min-llvm-version: 16
#![crate_type = "lib"]
// CHECK-LABEL: @slice_fold_to_last
#[no_mangle]
pub fn slice_fold_to_last(slice: &[i32]) -> Option<&i32> {
// CHECK-NOT: loop
// CHECK-NOT: br
// CHECK-NOT: call
// CHECK: ret
slice.iter().fold(None, |_, i| Some(i))
}