xref: /aosp_15_r20/external/llvm/test/Transforms/ObjCARC/expand.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt -objc-arc-expand -S < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-p:64:64:64"
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Workerdeclare i8* @objc_retain(i8*)
6*9880d681SAndroid Build Coastguard Workerdeclare i8* @objc_autorelease(i8*)
7*9880d681SAndroid Build Coastguard Workerdeclare i8* @objc_retainAutoreleasedReturnValue(i8*)
8*9880d681SAndroid Build Coastguard Workerdeclare i8* @objc_autoreleaseReturnValue(i8*)
9*9880d681SAndroid Build Coastguard Workerdeclare i8* @objc_retainAutorelease(i8*)
10*9880d681SAndroid Build Coastguard Workerdeclare i8* @objc_retainAutoreleaseReturnValue(i8*)
11*9880d681SAndroid Build Coastguard Workerdeclare i8* @objc_retainBlock(i8*)
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Workerdeclare void @use_pointer(i8*)
14*9880d681SAndroid Build Coastguard Worker
15*9880d681SAndroid Build Coastguard Worker; CHECK: define void @test_retain(i8* %x) [[NUW:#[0-9]+]] {
16*9880d681SAndroid Build Coastguard Worker; CHECK: call i8* @objc_retain(i8* %x)
17*9880d681SAndroid Build Coastguard Worker; CHECK: call void @use_pointer(i8* %x)
18*9880d681SAndroid Build Coastguard Worker; CHECK: }
19*9880d681SAndroid Build Coastguard Workerdefine void @test_retain(i8* %x) nounwind {
20*9880d681SAndroid Build Coastguard Workerentry:
21*9880d681SAndroid Build Coastguard Worker  %0 = call i8* @objc_retain(i8* %x) nounwind
22*9880d681SAndroid Build Coastguard Worker  call void @use_pointer(i8* %0)
23*9880d681SAndroid Build Coastguard Worker  ret void
24*9880d681SAndroid Build Coastguard Worker}
25*9880d681SAndroid Build Coastguard Worker
26*9880d681SAndroid Build Coastguard Worker; CHECK: define void @test_retainAutoreleasedReturnValue(i8* %x) [[NUW]] {
27*9880d681SAndroid Build Coastguard Worker; CHECK: call i8* @objc_retainAutoreleasedReturnValue(i8* %x)
28*9880d681SAndroid Build Coastguard Worker; CHECK: call void @use_pointer(i8* %x)
29*9880d681SAndroid Build Coastguard Worker; CHECK: }
30*9880d681SAndroid Build Coastguard Workerdefine void @test_retainAutoreleasedReturnValue(i8* %x) nounwind {
31*9880d681SAndroid Build Coastguard Workerentry:
32*9880d681SAndroid Build Coastguard Worker  %0 = call i8* @objc_retainAutoreleasedReturnValue(i8* %x) nounwind
33*9880d681SAndroid Build Coastguard Worker  call void @use_pointer(i8* %0)
34*9880d681SAndroid Build Coastguard Worker  ret void
35*9880d681SAndroid Build Coastguard Worker}
36*9880d681SAndroid Build Coastguard Worker
37*9880d681SAndroid Build Coastguard Worker; CHECK: define void @test_retainAutorelease(i8* %x) [[NUW]] {
38*9880d681SAndroid Build Coastguard Worker; CHECK: call i8* @objc_retainAutorelease(i8* %x)
39*9880d681SAndroid Build Coastguard Worker; CHECK: call void @use_pointer(i8* %x)
40*9880d681SAndroid Build Coastguard Worker; CHECK: }
41*9880d681SAndroid Build Coastguard Workerdefine void @test_retainAutorelease(i8* %x) nounwind {
42*9880d681SAndroid Build Coastguard Workerentry:
43*9880d681SAndroid Build Coastguard Worker  %0 = call i8* @objc_retainAutorelease(i8* %x) nounwind
44*9880d681SAndroid Build Coastguard Worker  call void @use_pointer(i8* %0)
45*9880d681SAndroid Build Coastguard Worker  ret void
46*9880d681SAndroid Build Coastguard Worker}
47*9880d681SAndroid Build Coastguard Worker
48*9880d681SAndroid Build Coastguard Worker; CHECK: define void @test_retainAutoreleaseReturnValue(i8* %x) [[NUW]] {
49*9880d681SAndroid Build Coastguard Worker; CHECK: call i8* @objc_retainAutoreleaseReturnValue(i8* %x)
50*9880d681SAndroid Build Coastguard Worker; CHECK: call void @use_pointer(i8* %x)
51*9880d681SAndroid Build Coastguard Worker; CHECK: }
52*9880d681SAndroid Build Coastguard Workerdefine void @test_retainAutoreleaseReturnValue(i8* %x) nounwind {
53*9880d681SAndroid Build Coastguard Workerentry:
54*9880d681SAndroid Build Coastguard Worker  %0 = call i8* @objc_retainAutoreleaseReturnValue(i8* %x) nounwind
55*9880d681SAndroid Build Coastguard Worker  call void @use_pointer(i8* %0)
56*9880d681SAndroid Build Coastguard Worker  ret void
57*9880d681SAndroid Build Coastguard Worker}
58*9880d681SAndroid Build Coastguard Worker
59*9880d681SAndroid Build Coastguard Worker; CHECK: define void @test_autorelease(i8* %x) [[NUW]] {
60*9880d681SAndroid Build Coastguard Worker; CHECK: call i8* @objc_autorelease(i8* %x)
61*9880d681SAndroid Build Coastguard Worker; CHECK: call void @use_pointer(i8* %x)
62*9880d681SAndroid Build Coastguard Worker; CHECK: }
63*9880d681SAndroid Build Coastguard Workerdefine void @test_autorelease(i8* %x) nounwind {
64*9880d681SAndroid Build Coastguard Workerentry:
65*9880d681SAndroid Build Coastguard Worker  %0 = call i8* @objc_autorelease(i8* %x) nounwind
66*9880d681SAndroid Build Coastguard Worker  call void @use_pointer(i8* %0)
67*9880d681SAndroid Build Coastguard Worker  ret void
68*9880d681SAndroid Build Coastguard Worker}
69*9880d681SAndroid Build Coastguard Worker
70*9880d681SAndroid Build Coastguard Worker; CHECK: define void @test_autoreleaseReturnValue(i8* %x) [[NUW]] {
71*9880d681SAndroid Build Coastguard Worker; CHECK: call i8* @objc_autoreleaseReturnValue(i8* %x)
72*9880d681SAndroid Build Coastguard Worker; CHECK: call void @use_pointer(i8* %x)
73*9880d681SAndroid Build Coastguard Worker; CHECK: }
74*9880d681SAndroid Build Coastguard Workerdefine void @test_autoreleaseReturnValue(i8* %x) nounwind {
75*9880d681SAndroid Build Coastguard Workerentry:
76*9880d681SAndroid Build Coastguard Worker  %0 = call i8* @objc_autoreleaseReturnValue(i8* %x) nounwind
77*9880d681SAndroid Build Coastguard Worker  call void @use_pointer(i8* %0)
78*9880d681SAndroid Build Coastguard Worker  ret void
79*9880d681SAndroid Build Coastguard Worker}
80*9880d681SAndroid Build Coastguard Worker
81*9880d681SAndroid Build Coastguard Worker;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
82*9880d681SAndroid Build Coastguard Worker; RetainBlock is not strictly forwarding. Do not touch it. ;
83*9880d681SAndroid Build Coastguard Worker;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
84*9880d681SAndroid Build Coastguard Worker
85*9880d681SAndroid Build Coastguard Worker; CHECK: define void @test_retainBlock(i8* %x) [[NUW]] {
86*9880d681SAndroid Build Coastguard Worker; CHECK: call i8* @objc_retainBlock(i8* %x)
87*9880d681SAndroid Build Coastguard Worker; CHECK: call void @use_pointer(i8* %0)
88*9880d681SAndroid Build Coastguard Worker; CHECK: }
89*9880d681SAndroid Build Coastguard Workerdefine void @test_retainBlock(i8* %x) nounwind {
90*9880d681SAndroid Build Coastguard Workerentry:
91*9880d681SAndroid Build Coastguard Worker  %0 = call i8* @objc_retainBlock(i8* %x) nounwind
92*9880d681SAndroid Build Coastguard Worker  call void @use_pointer(i8* %0)
93*9880d681SAndroid Build Coastguard Worker  ret void
94*9880d681SAndroid Build Coastguard Worker}
95