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-LABEL: @borrow_call
34 pub fn borrow_call(x: &i32, f: fn(&i32) -> &i32) -> &i32 {
35 // CHECK: call align 4 {{i32\*|ptr}} %f({{i32\*|ptr}} align 4 %x)
39 // CHECK: void @struct_({{%S\*|ptr}} sret(%S){{( %0)?}}, {{%S\*|ptr}} %x)
41 pub fn struct_(x: S) -> S {
45 // CHECK-LABEL: @struct_call
47 pub fn struct_call(x: S, f: fn(S) -> S) -> S {
48 // CHECK: call void %f({{%S\*|ptr}} sret(%S){{( %0)?}}, {{%S\*|ptr}} %{{.+}})
52 // CHECK: { i8, i8 } @enum_(i1 zeroext %x.0, i8 %x.1)
54 pub fn enum_(x: Option<u8>) -> Option<u8> {
58 // CHECK-LABEL: @enum_call
60 pub fn enum_call(x: Option<u8>, f: fn(Option<u8>) -> Option<u8>) -> Option<u8> {
61 // CHECK: call { i8, i8 } %f(i1 zeroext %x.0, i8 %x.1)