rust/tests/codegen/issues/issue-75978.rs
Nikita Popov 73f40d4293 Add codegen tests for issues fixed by LLVM 16
Fixes #75978.
Fixes #99960.
Fixes #101048.
Fixes #101082.
Fixes #101814.
Fixes #103132.
Fixes #103327.
2023-04-03 17:02:57 +02:00

20 lines
344 B
Rust

// compile-flags: -O
// min-llvm-version: 16
#![crate_type = "lib"]
#[no_mangle]
pub fn test() -> u32 {
// CHECK-LABEL: @test(
// CHECK: ret i32 13
let s = [1, 2, 3, 4, 5, 6, 7];
let mut iter = s.iter();
let mut sum = 0;
while let Some(_) = iter.next() {
sum += iter.next().map_or(1, |&x| x)
}
sum
}