1; RUN: opt -S -objc-arc < %s | FileCheck %s 2 3declare void @use_pointer(i8*) 4declare i8* @returner() 5declare i8* @objc_retain(i8*) 6declare i8* @objc_autoreleaseReturnValue(i8*) 7declare i8* @objc_retainAutoreleasedReturnValue(i8*) 8 9; Clean up residue left behind after inlining. 10 11; CHECK-LABEL: define void @test0( 12; CHECK: entry: 13; CHECK-NEXT: ret void 14; CHECK-NEXT: } 15define void @test0(i8* %call.i) { 16entry: 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-LABEL: define void @test1( 25; CHECK: entry: 26; CHECK-NEXT: ret void 27; CHECK-NEXT: } 28define void @test1(i8* %call.i) { 29entry: 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-LABEL: define void @test24( 38; CHECK-NEXT: entry: 39; CHECK-NEXT: call void @use_pointer(i8* %p) 40; CHECK-NEXT: ret void 41; CHECK-NEXT: } 42define void @test24(i8* %p) { 43entry: 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