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 [[TEST0:%.*]]*, [[TEST0:%.*]]** @test0_helper
11 // CHECK-NEXT: [[T0:%.*]] = bitcast [[TEST0]]* [[LD]] to i8*
12 // CHECK-NEXT: [[T1:%.*]] = tail call i8* @llvm.objc.retainAutoreleaseReturnValue(i8* [[T0]])
13 // CHECK-NEXT: [[T2:%.*]] = bitcast i8* [[T1]] to [[TEST0]]*
14 // CHECK-NEXT: ret [[TEST0]]* [[T2]]
18 extern id test1_helper;
21 // CHECK: [[LD:%.*]] = load i8*, i8** @test1_helper
22 // CHECK-NEXT: [[T0:%.*]] = tail call i8* @llvm.objc.retainAutoreleaseReturnValue(i8* [[LD]])
23 // CHECK-NEXT: ret i8* [[T0]]
27 // CHECK: [[X:%.*]] = alloca i8*
28 // CHECK-NEXT: store i8* null, i8** [[X]]
29 // CHECK-NEXT: call void @llvm.objc.destroyWeak(i8** [[X]])
30 // CHECK-NEXT: ret void
35 extern id test3_helper(void);
36 // CHECK: [[T0:%.*]] = call i8* @test3_helper()
37 // CHECK-NEXT: ret i8* [[T0]]
38 return test3_helper();
41 @interface Test4 { id x; } @end
42 @interface Test4_sub : Test4 { id y; } @end
44 extern Test4_sub *test4_helper(void);
45 // CHECK: [[T0:%.*]] = call [[TEST4S:%.*]]* @test4_helper()
46 // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST4S]]* [[T0]] to [[TEST4:%.*]]*
47 // CHECK-NEXT: ret [[TEST4]]* [[T1]]
48 return test4_helper();
51 // rdar://problem/9418404
58 // CHECK-LABEL: define{{.*}} void @test5()
59 // CHECK: [[X:%.*]] = alloca [[TEST5:%.*]]*,
60 // CHECK-NEXT: [[Y:%.*]] = alloca [[TEST5:%.*]]*,
61 // CHECK-NEXT: store [[TEST5]]* null, [[TEST5]]** [[X]],
62 // CHECK-NEXT: store [[TEST5]]* null, [[TEST5]]** [[Y]],
63 // CHECK-NEXT: [[T0:%.*]] = load [[TEST5]]*, [[TEST5]]** [[Y]],
64 // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST5]]** [[X]] to i8**
65 // CHECK-NEXT: [[T2:%.*]] = bitcast [[TEST5]]* [[T0]] to i8*
66 // CHECK-NEXT: call void @llvm.objc.storeStrong(i8** [[T1]], i8* [[T2]])
67 // CHECK-NEXT: [[T3:%.*]] = icmp ne [[TEST5]]* [[T0]], null
68 // CHECK-NEXT: br i1 [[T3]],