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 3 4// <rdar://24531556>: implement objc_retainAutoreleasedReturnValue on i386 5 6// CHECK-LABEL: define i8* @test0() 7id test0(void) { 8 extern id test0_helper(void); 9 // CHECK: [[T0:%.*]] = call i8* @test0_helper() 10 // CHECK-NEXT: ret i8* [[T0]] 11 return test0_helper(); 12} 13 14// CHECK-LABEL: define void @test1() 15void test1(void) { 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* @objc_retainAutoreleasedReturnValue(i8* [[T0]]) 20 // CHECK-NEXT: store i8* [[T1]], 21 // CHECK-NEXT: call void @objc_storeStrong( 22 // CHECK-NEXT: ret void 23 id x = test1_helper(); 24} 25 26// rdar://problem/12133032 27// CHECK-LABEL: define {{.*}} @test2() 28@class A; 29A *test2(void) { 30 extern A *test2_helper(void); 31 // CHECK: [[T0:%.*]] = call [[A:%.*]]* @test2_helper() 32 // CHECK-NEXT: ret [[A]]* [[T0]] 33 return test2_helper(); 34} 35 36// CHECK-LABEL: define i8* @test3() 37id test3(void) { 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(); 43} 44