1 // RUN: %clang_cc1 -triple i386-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -o - %s | FileCheck %s
2 // RUN: %clang_cc1 -triple i386-apple-iossimulator6.0 -emit-llvm -fblocks -fobjc-arc -o - %s | FileCheck %s
4 // <rdar://24531556>: implement objc_retainAutoreleasedReturnValue on i386
6 // CHECK-LABEL: define{{.*}} i8* @test0()
8 extern id test0_helper(void);
9 // CHECK: [[T0:%.*]] = call i8* @test0_helper()
10 // CHECK-NEXT: ret i8* [[T0]]
11 return test0_helper();
14 // CHECK-LABEL: define{{.*}} void @test1()
16 extern id test1_helper(void);
17 // CHECK: [[T0:%.*]] = call i8* @test1_helper()
18 // CHECK-NEXT: call void asm sideeffect "mov
19 // CHECK-NEXT: [[T1:%.*]] = call i8* @llvm.objc.retainAutoreleasedReturnValue(i8* [[T0]])
20 // CHECK-NEXT: store i8* [[T1]],
21 // CHECK-NEXT: call void @llvm.objc.storeStrong(
22 // CHECK-NEXT: ret void
23 id x = test1_helper();
26 // rdar://problem/12133032
27 // CHECK-LABEL: define {{.*}} @test2()
30 extern A *test2_helper(void);
31 // CHECK: [[T0:%.*]] = call [[A:%.*]]* @test2_helper()
32 // CHECK-NEXT: ret [[A]]* [[T0]]
33 return test2_helper();
36 // CHECK-LABEL: define{{.*}} i8* @test3()
38 extern A *test3_helper(void);
39 // CHECK: [[T0:%.*]] = call [[A]]* @test3_helper()
40 // CHECK-NEXT: [[T1:%.*]] = bitcast [[A]]* [[T0]] to i8*
41 // CHECK-NEXT: ret i8* [[T1]]
42 return test3_helper();