about summary refs log tree commit diff
path: root/tests/codegen-llvm/vec-len-invariant.rs
blob: 033181c2bfb72fbdd0d457a91f3c39a3feb9b893 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//@ compile-flags: -Copt-level=3
//@ only-64bit
//
// This test confirms that we do not reload the length of a Vec after growing it in push.

#![crate_type = "lib"]

// CHECK-LABEL: @should_load_once
#[no_mangle]
pub fn should_load_once(v: &mut Vec<u8>) {
    // CHECK: load i64
    // CHECK: call {{.*}}grow_one
    // CHECK-NOT: load i64
    // CHECK: add {{.*}}, 1
    v.push(1);
}