summaryrefslogtreecommitdiffstats
path: root/tests/codegen/vec-optimizes-away.rs
blob: 6f477a796b65d6b1af2746bb28b747511a168d26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// ignore-debug: the debug assertions get in the way
// no-system-llvm
// compile-flags: -O
#![crate_type = "lib"]

#[no_mangle]
pub fn sum_me() -> i32 {
    // CHECK-LABEL: @sum_me
    // CHECK-NEXT: {{^.*:$}}
    // CHECK-NEXT: {{.*}} load volatile i8, ptr @__rust_no_alloc_shim_is_unstable, align 1
    // CHECK-NEXT: ret i32 6
    vec![1, 2, 3].iter().sum::<i32>()
}