1// RUN: %clang_cc1 -triple armv7-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -o - %s | FileCheck %s
2// 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.
5
6id test0(void) {
7  extern id test0_helper(void);
8  // CHECK:      [[T0:%.*]] = call [[CC:(arm_aapcscc )?]]i8* @test0_helper()
9  // CHECK-NEXT: ret i8* [[T0]]
10  return test0_helper();
11}
12
13void test1(void) {
14  extern id test1_helper(void);
15  // CHECK:      [[T0:%.*]] = call [[CC]]i8* @test1_helper()
16  // CHECK-NEXT: call void asm sideeffect "mov\09{{fp, fp|r7, r7}}\09\09// marker for objc_retainAutoreleaseReturnValue"
17  // CHECK-NEXT: [[T1:%.*]] = call [[CC]]i8* @llvm.objc.retainAutoreleasedReturnValue(i8* [[T0]])
18  // CHECK-NEXT: store i8* [[T1]],
19  // CHECK-NEXT: call [[CC]]void @llvm.objc.storeStrong(
20  // CHECK-NEXT: ret void
21  id x = test1_helper();
22}
23
24// rdar://problem/12133032
25@class A;
26A *test2(void) {
27  extern A *test2_helper(void);
28  // CHECK:      [[T0:%.*]] = call [[CC]][[A:%.*]]* @test2_helper()
29  // CHECK-NEXT: ret [[A]]* [[T0]]
30  return test2_helper();
31}
32
33id test3(void) {
34  extern A *test3_helper(void);
35  // CHECK:      [[T0:%.*]] = call [[CC]][[A:%.*]]* @test3_helper()
36  // CHECK-NEXT: [[T1:%.*]] = bitcast [[A]]* [[T0]] to i8*
37  // CHECK-NEXT: ret i8* [[T1]]
38  return test3_helper();
39}
40