• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -objc-arc -S %s | FileCheck %s
2
3%0 = type opaque
4
5; Make sure ARC optimizer doesn't sink @obj_retain past @clang.arc.use.
6
7; CHECK: call i8* @objc_retain(
8; CHECK: call void (...) @clang.arc.use(
9; CHECK: call i8* @objc_retain(
10; CHECK: call void (...) @clang.arc.use(
11
12define 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* @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* @objc_retain(i8* %7)
23  call void (...) @clang.arc.use(%0* %3)
24  call void @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* @objc_retain(i8* %10)
30  call void (...) @clang.arc.use(%0* %6)
31  %tmp1 = load %0*, %0** %2, align 8
32  call void @objc_release(i8* %7)
33  call void @foo2(%0* %9)
34  call void @objc_release(i8* %10)
35  ret void
36}
37
38declare %0* @foo0() local_unnamed_addr
39declare void @foo1(%0**) local_unnamed_addr
40declare void @foo2(%0*) local_unnamed_addr
41
42declare i8* @objc_retainAutoreleasedReturnValue(i8*) local_unnamed_addr
43declare i8* @objc_retain(i8*) local_unnamed_addr
44declare void @clang.arc.use(...) local_unnamed_addr
45declare void @objc_release(i8*) local_unnamed_addr
46