brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.9 KiB · 19f25f9 Raw
123 lines · plain
1; Test that calls to ARC runtime functions are converted to intrinsic calls if2; the bitcode has the arm64 retainAutoreleasedReturnValueMarker metadata.3 4; upgrade-arc-runtime-calls.bc and upgrade-mrr-runtime-calls.bc are identical5; except that the former has the arm64 retainAutoreleasedReturnValueMarker6; metadata. upgrade-arc-runtime-calls-new.bc has the new module flag format of7; marker, it should not be upgraded.8 9; RUN: llvm-dis < %S/upgrade-arc-runtime-calls.bc | FileCheck -check-prefixes=ARC %s10; RUN: llvm-dis < %S/upgrade-mrr-runtime-calls.bc | FileCheck -check-prefixes=NOUPGRADE %s11; RUN: llvm-dis < %S/upgrade-arc-runtime-calls-new.bc | FileCheck -check-prefixes=NOUPGRADE %s12 13define void @testRuntimeCalls(i8* %a, i8** %b, i8** %c, i32* %d, i32** %e) personality i32 (...)* @__gxx_personality_v0 {14entry:15  %v0 = tail call i8* @objc_autorelease(i8* %a) #016  tail call void @objc_autoreleasePoolPop(i8* %a) #017  %v1 = tail call i8* @objc_autoreleasePoolPush() #018  %v2 = tail call i8* @objc_autoreleaseReturnValue(i8* %a) #019  tail call void @objc_copyWeak(i8** %b, i8** %c) #020  tail call void @objc_destroyWeak(i8** %b) #021  %v3 = tail call i32* @objc_initWeak(i32** %e, i32* %d) #022  %v4 = tail call i8* @objc_loadWeak(i8** %b) #023  %v5 = tail call i8* @objc_loadWeakRetained(i8** %b) #024  tail call void @objc_moveWeak(i8** %b, i8** %c) #025  tail call void @objc_release(i8* %a) #026  %v6 = tail call i8* @objc_retain(i8* %a) #027  %v7 = tail call i8* @objc_retainAutorelease(i8* %a) #028  %v8 = tail call i8* @objc_retainAutoreleaseReturnValue(i8* %a) #029  %v9 = tail call i8* @objc_retainAutoreleasedReturnValue(i8* %a) #030  %v10 = tail call i8* @objc_retainBlock(i8* %a) #031  tail call void @objc_storeStrong(i8** %b, i8* %a) #032  %v11 = tail call i8* @objc_storeWeak(i8** %b, i8* %a) #033  tail call void (...) @clang.arc.use(i8* %a) #034  %v12 = tail call i8* @objc_unsafeClaimAutoreleasedReturnValue(i8* %a) #035  %v13 = tail call i8* @objc_retainedObject(i8* %a) #036  %v14 = tail call i8* @objc_unretainedObject(i8* %a) #037  %v15 = tail call i8* @objc_unretainedPointer(i8* %a) #038  %v16 = tail call i8* @objc_retain.autorelease(i8* %a) #039  %v17 = tail call i32 @objc_sync.enter(i8* %a) #040  %v18 = tail call i32 @objc_sync.exit(i8* %a) #041  tail call void @objc_arc_annotation_topdown_bbstart(i8** %b, i8** %c) #042  tail call void @objc_arc_annotation_topdown_bbend(i8** %b, i8** %c) #043  tail call void @objc_arc_annotation_bottomup_bbstart(i8** %b, i8** %c) #044  tail call void @objc_arc_annotation_bottomup_bbend(i8** %b, i8** %c) #045  invoke void @objc_autoreleasePoolPop(i8* %a)46          to label %normalBlock unwind label %unwindBlock47normalBlock:48  ret void49unwindBlock:50  %ll = landingpad { i8*, i32 }51          cleanup52  ret void53}54 55// Check that auto-upgrader converts function calls to intrinsic calls. Note that56// the auto-upgrader doesn't touch invoke instructions.57 58// ARC: define void @testRuntimeCalls(ptr %[[A:.*]], ptr %[[B:.*]], ptr %[[C:.*]], ptr %[[D:.*]], ptr %[[E:.*]]) personality59// ARC: %[[V0:.*]] = tail call ptr @llvm.objc.autorelease(ptr %[[A]])60// ARC-NEXT: tail call void @llvm.objc.autoreleasePoolPop(ptr %[[A]])61// ARC-NEXT: %[[V1:.*]] = tail call ptr @llvm.objc.autoreleasePoolPush()62// ARC-NEXT: %[[V2:.*]] = tail call ptr @llvm.objc.autoreleaseReturnValue(ptr %[[A]])63// ARC-NEXT: tail call void @llvm.objc.copyWeak(ptr %[[B]], ptr %[[C]])64// ARC-NEXT: tail call void @llvm.objc.destroyWeak(ptr %[[B]])65// ARC-NEXT: %[[V102:.*]] = tail call ptr @llvm.objc.initWeak(ptr %[[E]], ptr %[[D]])66// ARC-NEXT: %[[V4:.*]] = tail call ptr @llvm.objc.loadWeak(ptr %[[B]])67// ARC-NEXT: %[[V5:.*]] = tail call ptr @llvm.objc.loadWeakRetained(ptr %[[B]])68// ARC-NEXT: tail call void @llvm.objc.moveWeak(ptr %[[B]], ptr %[[C]])69// ARC-NEXT: tail call void @llvm.objc.release(ptr %[[A]])70// ARC-NEXT: %[[V6:.*]] = tail call ptr @llvm.objc.retain(ptr %[[A]])71// ARC-NEXT: %[[V7:.*]] = tail call ptr @llvm.objc.retainAutorelease(ptr %[[A]])72// ARC-NEXT: %[[V8:.*]] = tail call ptr @llvm.objc.retainAutoreleaseReturnValue(ptr %[[A]])73// ARC-NEXT: %[[V9:.*]] = tail call ptr @llvm.objc.retainAutoreleasedReturnValue(ptr %[[A]])74// ARC-NEXT: %[[V10:.*]] = tail call ptr @llvm.objc.retainBlock(ptr %[[A]])75// ARC-NEXT: tail call void @llvm.objc.storeStrong(ptr %[[B]], ptr %[[A]])76// ARC-NEXT: %[[V11:.*]] = tail call ptr @llvm.objc.storeWeak(ptr %[[B]], ptr %[[A]])77// ARC-NEXT: tail call void (...) @llvm.objc.clang.arc.use(ptr %[[A]])78// ARC-NEXT: %[[V12:.*]] = tail call ptr @llvm.objc.unsafeClaimAutoreleasedReturnValue(ptr %[[A]])79// ARC-NEXT: %[[V13:.*]] = tail call ptr @llvm.objc.retainedObject(ptr %[[A]])80// ARC-NEXT: %[[V14:.*]] = tail call ptr @llvm.objc.unretainedObject(ptr %[[A]])81// ARC-NEXT: %[[V15:.*]] = tail call ptr @llvm.objc.unretainedPointer(ptr %[[A]])82// ARC-NEXT: %[[V16:.*]] = tail call ptr @objc_retain.autorelease(ptr %[[A]])83// ARC-NEXT: %[[V17:.*]] = tail call i32 @objc_sync.enter(ptr %[[A]])84// ARC-NEXT: %[[V18:.*]] = tail call i32 @objc_sync.exit(ptr %[[A]])85// ARC-NEXT: tail call void @llvm.objc.arc.annotation.topdown.bbstart(ptr %[[B]], ptr %[[C]])86// ARC-NEXT: tail call void @llvm.objc.arc.annotation.topdown.bbend(ptr %[[B]], ptr %[[C]])87// ARC-NEXT: tail call void @llvm.objc.arc.annotation.bottomup.bbstart(ptr %[[B]], ptr %[[C]])88// ARC-NEXT: tail call void @llvm.objc.arc.annotation.bottomup.bbend(ptr %[[B]], ptr %[[C]])89// ARC-NEXT: invoke void @objc_autoreleasePoolPop(ptr %[[A]])90 91// NOUPGRADE: define void @testRuntimeCalls(ptr %[[A:.*]], ptr %[[B:.*]], ptr %[[C:.*]], ptr %[[D:.*]], ptr %[[E:.*]]) personality92// NOUPGRADE: %[[V0:.*]] = tail call ptr @objc_autorelease(ptr %[[A]])93// NOUPGRADE-NEXT: tail call void @objc_autoreleasePoolPop(ptr %[[A]])94// NOUPGRADE-NEXT: %[[V1:.*]] = tail call ptr @objc_autoreleasePoolPush()95// NOUPGRADE-NEXT: %[[V2:.*]] = tail call ptr @objc_autoreleaseReturnValue(ptr %[[A]])96// NOUPGRADE-NEXT: tail call void @objc_copyWeak(ptr %[[B]], ptr %[[C]])97// NOUPGRADE-NEXT: tail call void @objc_destroyWeak(ptr %[[B]])98// NOUPGRADE-NEXT: %[[V3:.*]] = tail call ptr @objc_initWeak(ptr %[[E]], ptr %[[D]])99// NOUPGRADE-NEXT: %[[V4:.*]] = tail call ptr @objc_loadWeak(ptr %[[B]])100// NOUPGRADE-NEXT: %[[V5:.*]] = tail call ptr @objc_loadWeakRetained(ptr %[[B]])101// NOUPGRADE-NEXT: tail call void @objc_moveWeak(ptr %[[B]], ptr %[[C]])102// NOUPGRADE-NEXT: tail call void @objc_release(ptr %[[A]])103// NOUPGRADE-NEXT: %[[V6:.*]] = tail call ptr @objc_retain(ptr %[[A]])104// NOUPGRADE-NEXT: %[[V7:.*]] = tail call ptr @objc_retainAutorelease(ptr %[[A]])105// NOUPGRADE-NEXT: %[[V8:.*]] = tail call ptr @objc_retainAutoreleaseReturnValue(ptr %[[A]])106// NOUPGRADE-NEXT: %[[V9:.*]] = tail call ptr @objc_retainAutoreleasedReturnValue(ptr %[[A]])107// NOUPGRADE-NEXT: %[[V10:.*]] = tail call ptr @objc_retainBlock(ptr %[[A]])108// NOUPGRADE-NEXT: tail call void @objc_storeStrong(ptr %[[B]], ptr %[[A]])109// NOUPGRADE-NEXT: %[[V11:.*]] = tail call ptr @objc_storeWeak(ptr %[[B]], ptr %[[A]])110// NOUPGRADE-NEXT: tail call void (...) @llvm.objc.clang.arc.use(ptr %[[A]])111// NOUPGRADE-NEXT: %[[V12:.*]] = tail call ptr @objc_unsafeClaimAutoreleasedReturnValue(ptr %[[A]])112// NOUPGRADE-NEXT: %[[V13:.*]] = tail call ptr @objc_retainedObject(ptr %[[A]])113// NOUPGRADE-NEXT: %[[V14:.*]] = tail call ptr @objc_unretainedObject(ptr %[[A]])114// NOUPGRADE-NEXT: %[[V15:.*]] = tail call ptr @objc_unretainedPointer(ptr %[[A]])115// NOUPGRADE-NEXT: %[[V16:.*]] = tail call ptr @objc_retain.autorelease(ptr %[[A]])116// NOUPGRADE-NEXT: %[[V17:.*]] = tail call i32 @objc_sync.enter(ptr %[[A]])117// NOUPGRADE-NEXT: %[[V18:.*]] = tail call i32 @objc_sync.exit(ptr %[[A]])118// NOUPGRADE-NEXT: tail call void @objc_arc_annotation_topdown_bbstart(ptr %[[B]], ptr %[[C]])119// NOUPGRADE-NEXT: tail call void @objc_arc_annotation_topdown_bbend(ptr %[[B]], ptr %[[C]])120// NOUPGRADE-NEXT: tail call void @objc_arc_annotation_bottomup_bbstart(ptr %[[B]], ptr %[[C]])121// NOUPGRADE-NEXT: tail call void @objc_arc_annotation_bottomup_bbend(ptr %[[B]], ptr %[[C]])122// NOUPGRADE-NEXT: invoke void @objc_autoreleasePoolPop(ptr %[[A]])123