1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // compile-flags: -C no-prepopulate-passes
13 #![crate_type = "lib"]
22 // CHECK-LABEL: @borrow
24 pub fn borrow(x: &i32) -> &i32 {
25 // CHECK: load {{(i32\*, )?}}i32** %x{{.*}}, !nonnull
31 pub fn _box(x: Box<i32>) -> i32 {
32 // CHECK: load {{(i32\*, )?}}i32** %x{{.*}}, !nonnull
36 // CHECK-LABEL: small_array_alignment
37 // The array is loaded as i32, but its alignment is lower, go with 1 byte to avoid target
38 // dependent alignment
40 pub fn small_array_alignment(x: [i8; 4]) -> [i8; 4] {
41 // CHECK: [[VAR:%[0-9]+]] = load {{(i32, )?}}i32* %{{.*}}, align 1
42 // CHECK: ret i32 [[VAR]]
46 // CHECK-LABEL: small_struct_alignment
47 // The struct is loaded as i32, but its alignment is lower, go with 1 byte to avoid target
48 // dependent alignment
50 pub fn small_struct_alignment(x: Bytes) -> Bytes {
51 // CHECK: [[VAR:%[0-9]+]] = load {{(i32, )?}}i32* %{{.*}}, align 1
52 // CHECK: ret i32 [[VAR]]