95 lines · plain
1; RUN: opt -passes=objc-arc-expand -S < %s | FileCheck %s2 3target datalayout = "e-p:64:64:64"4 5declare ptr @llvm.objc.retain(ptr)6declare ptr @llvm.objc.autorelease(ptr)7declare ptr @llvm.objc.retainAutoreleasedReturnValue(ptr)8declare ptr @llvm.objc.autoreleaseReturnValue(ptr)9declare ptr @llvm.objc.retainAutorelease(ptr)10declare ptr @llvm.objc.retainAutoreleaseReturnValue(ptr)11declare ptr @llvm.objc.retainBlock(ptr)12 13declare void @use_pointer(ptr)14 15; CHECK: define void @test_retain(ptr %x) [[NUW:#[0-9]+]] {16; CHECK: call ptr @llvm.objc.retain(ptr %x)17; CHECK: call void @use_pointer(ptr %x)18; CHECK: }19define void @test_retain(ptr %x) nounwind {20entry:21 %0 = call ptr @llvm.objc.retain(ptr %x) nounwind22 call void @use_pointer(ptr %0)23 ret void24}25 26; CHECK: define void @test_retainAutoreleasedReturnValue(ptr %x) [[NUW]] {27; CHECK: call ptr @llvm.objc.retainAutoreleasedReturnValue(ptr %x)28; CHECK: call void @use_pointer(ptr %x)29; CHECK: }30define void @test_retainAutoreleasedReturnValue(ptr %x) nounwind {31entry:32 %0 = call ptr @llvm.objc.retainAutoreleasedReturnValue(ptr %x) nounwind33 call void @use_pointer(ptr %0)34 ret void35}36 37; CHECK: define void @test_retainAutorelease(ptr %x) [[NUW]] {38; CHECK: call ptr @llvm.objc.retainAutorelease(ptr %x)39; CHECK: call void @use_pointer(ptr %x)40; CHECK: }41define void @test_retainAutorelease(ptr %x) nounwind {42entry:43 %0 = call ptr @llvm.objc.retainAutorelease(ptr %x) nounwind44 call void @use_pointer(ptr %0)45 ret void46}47 48; CHECK: define void @test_retainAutoreleaseReturnValue(ptr %x) [[NUW]] {49; CHECK: call ptr @llvm.objc.retainAutoreleaseReturnValue(ptr %x)50; CHECK: call void @use_pointer(ptr %x)51; CHECK: }52define void @test_retainAutoreleaseReturnValue(ptr %x) nounwind {53entry:54 %0 = call ptr @llvm.objc.retainAutoreleaseReturnValue(ptr %x) nounwind55 call void @use_pointer(ptr %0)56 ret void57}58 59; CHECK: define void @test_autorelease(ptr %x) [[NUW]] {60; CHECK: call ptr @llvm.objc.autorelease(ptr %x)61; CHECK: call void @use_pointer(ptr %x)62; CHECK: }63define void @test_autorelease(ptr %x) nounwind {64entry:65 %0 = call ptr @llvm.objc.autorelease(ptr %x) nounwind66 call void @use_pointer(ptr %0)67 ret void68}69 70; CHECK: define void @test_autoreleaseReturnValue(ptr %x) [[NUW]] {71; CHECK: call ptr @llvm.objc.autoreleaseReturnValue(ptr %x)72; CHECK: call void @use_pointer(ptr %x)73; CHECK: }74define void @test_autoreleaseReturnValue(ptr %x) nounwind {75entry:76 %0 = call ptr @llvm.objc.autoreleaseReturnValue(ptr %x) nounwind77 call void @use_pointer(ptr %0)78 ret void79}80 81;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;82; RetainBlock is not strictly forwarding. Do not touch it. ;83;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;84 85; CHECK: define void @test_retainBlock(ptr %x) [[NUW]] {86; CHECK: call ptr @llvm.objc.retainBlock(ptr %x)87; CHECK: call void @use_pointer(ptr %0)88; CHECK: }89define void @test_retainBlock(ptr %x) nounwind {90entry:91 %0 = call ptr @llvm.objc.retainBlock(ptr %x) nounwind92 call void @use_pointer(ptr %0)93 ret void94}95