1 ; RUN: opt -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 i8* @llvm.objc.retain
8 ; CHECK: call void (...) @llvm.objc.clang.arc.use(
9 ; CHECK: call i8* @llvm.objc.retain
10 ; CHECK: call void (...) @llvm.objc.clang.arc.use(
12 define void @runTest() local_unnamed_addr {
13 %1 = alloca %0*, align 8
14 %2 = alloca %0*, align 8
15 %3 = tail call %0* @foo0()
16 %4 = bitcast %0* %3 to i8*
17 %5 = tail call i8* @llvm.objc.retainAutoreleasedReturnValue(i8* %4)
18 store %0* %3, %0** %1, align 8
19 call void @foo1(%0** nonnull %1)
20 %6 = load %0*, %0** %1, align 8
21 %7 = bitcast %0* %6 to i8*
22 %8 = call i8* @llvm.objc.retain(i8* %7)
23 call void (...) @llvm.objc.clang.arc.use(%0* %3)
24 call void @llvm.objc.release(i8* %4)
25 store %0* %6, %0** %2, align 8
26 call void @foo1(%0** nonnull %2)
27 %9 = load %0*, %0** %2, align 8
28 %10 = bitcast %0* %9 to i8*
29 %11 = call i8* @llvm.objc.retain(i8* %10)
30 call void (...) @llvm.objc.clang.arc.use(%0* %6)
31 %tmp1 = load %0*, %0** %2, align 8
32 call void @llvm.objc.release(i8* %7)
33 call void @foo2(%0* %9)
34 call void @llvm.objc.release(i8* %10)
38 declare %0* @foo0() local_unnamed_addr
39 declare void @foo1(%0**) local_unnamed_addr
40 declare void @foo2(%0*) local_unnamed_addr
42 declare i8* @llvm.objc.retainAutoreleasedReturnValue(i8*) local_unnamed_addr
43 declare i8* @llvm.objc.retain(i8*) local_unnamed_addr
44 declare void @llvm.objc.clang.arc.use(...) local_unnamed_addr
45 declare void @llvm.objc.release(i8*) local_unnamed_addr