1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-runtime-has-weak -fblocks -fobjc-arc -o - %s | FileCheck %s
3 // A test to ensure that we generate fused calls at -O0.
7 extern Test0 *test0_helper;
10 // CHECK: [[LD:%.*]] = load ptr, ptr @test0_helper
11 // CHECK-NEXT: [[T1:%.*]] = tail call ptr @llvm.objc.retainAutoreleaseReturnValue(ptr [[LD]])
12 // CHECK-NEXT: ret ptr [[T1]]
16 extern id test1_helper;
19 // CHECK: [[LD:%.*]] = load ptr, ptr @test1_helper
20 // CHECK-NEXT: [[T0:%.*]] = tail call ptr @llvm.objc.retainAutoreleaseReturnValue(ptr [[LD]])
21 // CHECK-NEXT: ret ptr [[T0]]
25 // CHECK: [[X:%.*]] = alloca ptr
26 // CHECK-NEXT: store ptr null, ptr [[X]]
27 // CHECK-NEXT: call void @llvm.objc.destroyWeak(ptr [[X]])
28 // CHECK-NEXT: ret void
33 extern id test3_helper(void);
34 // CHECK: [[T0:%.*]] = call ptr @test3_helper()
35 // CHECK-NEXT: ret ptr [[T0]]
36 return test3_helper();
39 @interface Test4 { id x; } @end
40 @interface Test4_sub : Test4 { id y; } @end
42 extern Test4_sub *test4_helper(void);
43 // CHECK: [[T0:%.*]] = call ptr @test4_helper()
44 // CHECK-NEXT: ret ptr [[T0]]
45 return test4_helper();
54 // CHECK-LABEL: define{{.*}} void @test5()
55 // CHECK: [[X:%.*]] = alloca ptr,
56 // CHECK-NEXT: [[Y:%.*]] = alloca ptr,
57 // CHECK-NEXT: store ptr null, ptr [[X]],
58 // CHECK-NEXT: store ptr null, ptr [[Y]],
59 // CHECK-NEXT: [[T0:%.*]] = load ptr, ptr [[Y]],
60 // CHECK-NEXT: call void @llvm.objc.storeStrong(ptr [[X]], ptr [[T0]])
61 // CHECK-NEXT: [[T3:%.*]] = icmp ne ptr [[T0]], null
62 // CHECK-NEXT: br i1 [[T3]],