1 // compile-flags: -C opt-level=0 -C no-prepopulate-passes
3 // This test checks that arguments/returns in opt-level=0 builds,
4 // while lacking attributes used for optimization, still have ABI-affecting attributes.
7 #![feature(rustc_attrs)]
13 // CHECK: zeroext i1 @boolean(i1 zeroext %x)
15 pub fn boolean(x: bool) -> bool {
19 // CHECK-LABEL: @boolean_call
21 pub fn boolean_call(x: bool, f: fn(bool) -> bool) -> bool {
22 // CHECK: call zeroext i1 %f(i1 zeroext %x)
26 // CHECK: align 4 {{i32\*|ptr}} @borrow({{i32\*|ptr}} align 4 %x)
28 pub fn borrow(x: &i32) -> &i32 {
32 // CHECK: align 4 {{i32\*|ptr}} @borrow_mut({{i32\*|ptr}} align 4 %x)
34 pub fn borrow_mut(x: &mut i32) -> &mut i32 {
38 // CHECK-LABEL: @borrow_call
40 pub fn borrow_call(x: &i32, f: fn(&i32) -> &i32) -> &i32 {
41 // CHECK: call align 4 {{i32\*|ptr}} %f({{i32\*|ptr}} align 4 %x)
45 // CHECK: void @struct_({{%S\*|ptr}} sret(%S){{( %0)?}}, {{%S\*|ptr}} %x)
47 pub fn struct_(x: S) -> S {
51 // CHECK-LABEL: @struct_call
53 pub fn struct_call(x: S, f: fn(S) -> S) -> S {
54 // CHECK: call void %f({{%S\*|ptr}} sret(%S){{( %0)?}}, {{%S\*|ptr}} %{{.+}})
58 // CHECK: { i8, i8 } @enum_(i1 zeroext %x.0, i8 %x.1)
60 pub fn enum_(x: Option<u8>) -> Option<u8> {
64 // CHECK-LABEL: @enum_call
66 pub fn enum_call(x: Option<u8>, f: fn(Option<u8>) -> Option<u8>) -> Option<u8> {
67 // CHECK: call { i8, i8 } %f(i1 zeroext %x.0, i8 %x.1)