1 ; RUN: opt -passes=objc-arc -S %s | FileCheck %s
5 ; Make sure ARC optimizer doesn't sink @obj_retain past @llvm.objc.clang.arc.use.
7 ; CHECK: call ptr @llvm.objc.retain
8 ; CHECK: call void (...) @llvm.objc.clang.arc.use(
9 ; CHECK: call ptr @llvm.objc.retain
10 ; CHECK: call void (...) @llvm.objc.clang.arc.use(
12 define void @runTest() local_unnamed_addr {
13 %1 = alloca ptr, align 8
14 %2 = alloca ptr, align 8
15 %3 = tail call ptr @foo0()
16 %4 = tail call ptr @llvm.objc.retainAutoreleasedReturnValue(ptr %3)
17 store ptr %3, ptr %1, align 8
18 call void @foo1(ptr nonnull %1)
19 %5 = load ptr, ptr %1, align 8
20 %6 = call ptr @llvm.objc.retain(ptr %5)
21 call void (...) @llvm.objc.clang.arc.use(ptr %3)
22 call void @llvm.objc.release(ptr %3)
23 store ptr %5, ptr %2, align 8
24 call void @foo1(ptr nonnull %2)
25 %7 = load ptr, ptr %2, align 8
26 %8 = call ptr @llvm.objc.retain(ptr %7)
27 call void (...) @llvm.objc.clang.arc.use(ptr %5)
28 %tmp1 = load ptr, ptr %2, align 8
29 call void @llvm.objc.release(ptr %5)
30 call void @foo2(ptr %7)
31 call void @llvm.objc.release(ptr %7)
35 declare ptr @foo0() local_unnamed_addr
36 declare void @foo1(ptr) local_unnamed_addr
37 declare void @foo2(ptr) local_unnamed_addr
39 declare ptr @llvm.objc.retainAutoreleasedReturnValue(ptr) local_unnamed_addr
40 declare ptr @llvm.objc.retain(ptr) local_unnamed_addr
41 declare void @llvm.objc.clang.arc.use(...) local_unnamed_addr
42 declare void @llvm.objc.release(ptr) local_unnamed_addr