1 ; RUN: opt -S -objc-arc < %s | FileCheck %s 2 3 declare void @use_pointer(i8*) 4 declare i8* @returner() 5 declare i8* @objc_retain(i8*) 6 declare i8* @objc_autoreleaseReturnValue(i8*) 7 declare i8* @objc_retainAutoreleasedReturnValue(i8*) 8 9 ; Clean up residue left behind after inlining. 10 11 ; CHECK: define void @test0( 12 ; CHECK: entry: 13 ; CHECK-NEXT: ret void 14 ; CHECK-NEXT: } 15 define void @test0(i8* %call.i) { 16 entry: 17 %0 = tail call i8* @objc_retain(i8* %call.i) nounwind 18 %1 = tail call i8* @objc_autoreleaseReturnValue(i8* %0) nounwind 19 ret void 20 } 21 22 ; Same as test0, but with slightly different use arrangements. 23 24 ; CHECK: define void @test1( 25 ; CHECK: entry: 26 ; CHECK-NEXT: ret void 27 ; CHECK-NEXT: } 28 define void @test1(i8* %call.i) { 29 entry: 30 %0 = tail call i8* @objc_retain(i8* %call.i) nounwind 31 %1 = tail call i8* @objc_autoreleaseReturnValue(i8* %call.i) nounwind 32 ret void 33 } 34 35 ; Delete a retainRV+autoreleaseRV even if the pointer is used. 36 37 ; CHECK: define void @test24( 38 ; CHECK-NEXT: entry: 39 ; CHECK-NEXT: call void @use_pointer(i8* %p) 40 ; CHECK-NEXT: ret void 41 ; CHECK-NEXT: } 42 define void @test24(i8* %p) { 43 entry: 44 call i8* @objc_autoreleaseReturnValue(i8* %p) nounwind 45 call i8* @objc_retainAutoreleasedReturnValue(i8* %p) nounwind 46 call void @use_pointer(i8* %p) 47 ret void 48 } 49