rust/tests/codegen/issues/issue-107681-unwrap_unchecked.rs
2024-08-08 18:08:44 +08:00

21 lines
454 B
Rust

//@ compile-flags: -O
//@ min-llvm-version: 19
// Test for #107681.
// Make sure we don't create `br` or `select` instructions.
#![crate_type = "lib"]
use std::iter::Copied;
use std::slice::Iter;
#[no_mangle]
pub unsafe fn foo(x: &mut Copied<Iter<'_, u32>>) -> u32 {
// CHECK-LABEL: @foo(
// CHECK-NOT: br
// CHECK-NOT: select
// CHECK: [[RET:%.*]] = load i32, ptr
// CHECK-NEXT: ret i32 [[RET]]
x.next().unwrap_unchecked()
}