summary refs log tree commit diff
path: root/tests/codegen-llvm/issues/issue-107681-unwrap_unchecked.rs
blob: 69aefc6b1fb54f035215bbcd8c352d818a53216f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//@ compile-flags: -Copt-level=3

// 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()
}