blob: 8d5f0d5c4b35910479352f7e6374d53fdbc3b155 [file] [log] [blame]
John McCall9b0a7ce2011-10-02 01:16:38 +00001// RUN: %clang_cc1 -triple armv7-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -o - %s | FileCheck %s
Tim Northovera2ee4332014-03-29 15:09:45 +00002// RUN: %clang_cc1 -triple arm64-apple-ios -emit-llvm -fblocks -fobjc-arc -o - %s | FileCheck %s
3
4// <rdar://12438598>: use an autorelease marker on ARM64.
John McCall31168b02011-06-15 23:02:42 +00005
6id test0(void) {
7 extern id test0_helper(void);
Tim Northovera2ee4332014-03-29 15:09:45 +00008 // CHECK: [[T0:%.*]] = call [[CC:(arm_aapcscc )?]]i8* @test0_helper()
John McCall31168b02011-06-15 23:02:42 +00009 // CHECK-NEXT: ret i8* [[T0]]
10 return test0_helper();
11}
12
13void test1(void) {
14 extern id test1_helper(void);
Tim Northovera2ee4332014-03-29 15:09:45 +000015 // CHECK: [[T0:%.*]] = call [[CC]]i8* @test1_helper()
16 // CHECK-NEXT: call void asm sideeffect "mov
17 // CHECK-NEXT: [[T1:%.*]] = call [[CC]]i8* @objc_retainAutoreleasedReturnValue(i8* [[T0]])
John McCall31168b02011-06-15 23:02:42 +000018 // CHECK-NEXT: store i8* [[T1]],
Tim Northovera2ee4332014-03-29 15:09:45 +000019 // CHECK-NEXT: call [[CC]]void @objc_storeStrong(
John McCall31168b02011-06-15 23:02:42 +000020 // CHECK-NEXT: ret void
21 id x = test1_helper();
22}
John McCallcfa4e9b2012-09-07 23:30:50 +000023
24// rdar://problem/12133032
25@class A;
26A *test2(void) {
27 extern A *test2_helper(void);
Tim Northovera2ee4332014-03-29 15:09:45 +000028 // CHECK: [[T0:%.*]] = call [[CC]][[A:%.*]]* @test2_helper()
John McCallcfa4e9b2012-09-07 23:30:50 +000029 // CHECK-NEXT: ret [[A]]* [[T0]]
30 return test2_helper();
31}
32
33id test3(void) {
34 extern A *test3_helper(void);
Tim Northovera2ee4332014-03-29 15:09:45 +000035 // CHECK: [[T0:%.*]] = call [[CC]][[A:%.*]]* @test3_helper()
John McCallcfa4e9b2012-09-07 23:30:50 +000036 // CHECK-NEXT: [[T1:%.*]] = bitcast [[A]]* [[T0]] to i8*
37 // CHECK-NEXT: ret i8* [[T1]]
38 return test3_helper();
39}