1 ; RUN: opt -S -basicaa -objc-arc < %s | FileCheck %s 2 ; rdar://11434915 3 4 ; Delete the weak calls and replace them with just the net retain. 5 6 ; CHECK: define void @test0(i8* %p) { 7 ; CHECK-NEXT: call i8* @objc_retain(i8* %p) 8 ; CHECK-NEXT: ret void 9 10 define void @test0(i8* %p) { 11 %weakBlock = alloca i8*, align 8 12 %tmp7 = call i8* @objc_initWeak(i8** %weakBlock, i8* %p) nounwind 13 %tmp26 = call i8* @objc_loadWeakRetained(i8** %weakBlock) nounwind 14 call void @objc_destroyWeak(i8** %weakBlock) nounwind 15 ret void 16 } 17 18 ; CHECK: define i8* @test1(i8* %p) { 19 ; CHECK-NEXT: call i8* @objc_retain(i8* %p) 20 ; CHECK-NEXT: ret i8* %p 21 22 define i8* @test1(i8* %p) { 23 %weakBlock = alloca i8*, align 8 24 %tmp7 = call i8* @objc_initWeak(i8** %weakBlock, i8* %p) nounwind 25 %tmp26 = call i8* @objc_loadWeakRetained(i8** %weakBlock) nounwind 26 call void @objc_destroyWeak(i8** %weakBlock) nounwind 27 ret i8* %tmp26 28 } 29 30 ; CHECK: define i8* @test2(i8* %p, i8* %q) { 31 ; CHECK-NEXT: call i8* @objc_retain(i8* %q) 32 ; CHECK-NEXT: ret i8* %q 33 34 define i8* @test2(i8* %p, i8* %q) { 35 %weakBlock = alloca i8*, align 8 36 %tmp7 = call i8* @objc_initWeak(i8** %weakBlock, i8* %p) nounwind 37 %tmp19 = call i8* @objc_storeWeak(i8** %weakBlock, i8* %q) nounwind 38 %tmp26 = call i8* @objc_loadWeakRetained(i8** %weakBlock) nounwind 39 call void @objc_destroyWeak(i8** %weakBlock) nounwind 40 ret i8* %tmp26 41 } 42 43 declare i8* @objc_initWeak(i8**, i8*) 44 declare void @objc_destroyWeak(i8**) 45 declare i8* @objc_loadWeakRetained(i8**) 46 declare i8* @objc_storeWeak(i8** %weakBlock, i8* %q) 47