1 ; RUN: opt -S -basicaa -objc-arc < %s | FileCheck %s
4 ; Delete the weak calls and replace them with just the net retain.
6 ; CHECK: define void @test0(i8* %p) {
7 ; CHECK-NEXT: call i8* @llvm.objc.retain(i8* %p)
10 define void @test0(i8* %p) {
11 %weakBlock = alloca i8*, align 8
12 %tmp7 = call i8* @llvm.objc.initWeak(i8** %weakBlock, i8* %p) nounwind
13 %tmp26 = call i8* @llvm.objc.loadWeakRetained(i8** %weakBlock) nounwind
14 call void @llvm.objc.destroyWeak(i8** %weakBlock) nounwind
18 ; CHECK: define i8* @test1(i8* %p) {
19 ; CHECK-NEXT: call i8* @llvm.objc.retain(i8* %p)
20 ; CHECK-NEXT: ret i8* %p
22 define i8* @test1(i8* %p) {
23 %weakBlock = alloca i8*, align 8
24 %tmp7 = call i8* @llvm.objc.initWeak(i8** %weakBlock, i8* %p) nounwind
25 %tmp26 = call i8* @llvm.objc.loadWeakRetained(i8** %weakBlock) nounwind
26 call void @llvm.objc.destroyWeak(i8** %weakBlock) nounwind
30 ; CHECK: define i8* @test2(i8* %p, i8* %q) {
31 ; CHECK-NEXT: call i8* @llvm.objc.retain(i8* %q)
32 ; CHECK-NEXT: ret i8* %q
34 define i8* @test2(i8* %p, i8* %q) {
35 %weakBlock = alloca i8*, align 8
36 %tmp7 = call i8* @llvm.objc.initWeak(i8** %weakBlock, i8* %p) nounwind
37 %tmp19 = call i8* @llvm.objc.storeWeak(i8** %weakBlock, i8* %q) nounwind
38 %tmp26 = call i8* @llvm.objc.loadWeakRetained(i8** %weakBlock) nounwind
39 call void @llvm.objc.destroyWeak(i8** %weakBlock) nounwind
43 declare i8* @llvm.objc.initWeak(i8**, i8*)
44 declare void @llvm.objc.destroyWeak(i8**)
45 declare i8* @llvm.objc.loadWeakRetained(i8**)
46 declare i8* @llvm.objc.storeWeak(i8** %weakBlock, i8* %q)