mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-10 02:36:06 +00:00
1ef70ff39b
Now that `Metadata` is typeless, reflect that in the assembly. These are the matching assembly changes for the metadata/value split in r223802. - Only use the `metadata` type when referencing metadata from a call intrinsic -- i.e., only when it's used as a `Value`. - Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode` when referencing it from call intrinsics. So, assembly like this: define @foo(i32 %v) { call void @llvm.foo(metadata !{i32 %v}, metadata !0) call void @llvm.foo(metadata !{i32 7}, metadata !0) call void @llvm.foo(metadata !1, metadata !0) call void @llvm.foo(metadata !3, metadata !0) call void @llvm.foo(metadata !{metadata !3}, metadata !0) ret void, !bar !2 } !0 = metadata !{metadata !2} !1 = metadata !{i32* @global} !2 = metadata !{metadata !3} !3 = metadata !{} turns into this: define @foo(i32 %v) { call void @llvm.foo(metadata i32 %v, metadata !0) call void @llvm.foo(metadata i32 7, metadata !0) call void @llvm.foo(metadata i32* @global, metadata !0) call void @llvm.foo(metadata !3, metadata !0) call void @llvm.foo(metadata !{!3}, metadata !0) ret void, !bar !2 } !0 = !{!2} !1 = !{i32* @global} !2 = !{!3} !3 = !{} I wrote an upgrade script that handled almost all of the tests in llvm and many of the tests in cfe (even handling many `CHECK` lines). I've attached it (or will attach it in a moment if you're speedy) to PR21532 to help everyone update their out-of-tree testcases. This is part of PR21532. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224257 91177308-0d34-0410-b5e6-96231b3b80d8
84 lines
3.3 KiB
LLVM
84 lines
3.3 KiB
LLVM
; This file consists of various tests which ensure that the objc-arc-annotations
|
|
; are working correctly. In the future, I will use this in other lit tests to
|
|
; check the data flow analysis of ARC.
|
|
|
|
; REQUIRES: asserts
|
|
; RUN: opt -S -objc-arc -enable-objc-arc-annotations < %s | FileCheck %s
|
|
|
|
declare i8* @objc_retain(i8*)
|
|
declare i8* @objc_retainAutoreleasedReturnValue(i8*)
|
|
declare void @objc_release(i8*)
|
|
declare i8* @objc_autorelease(i8*)
|
|
declare i8* @objc_autoreleaseReturnValue(i8*)
|
|
declare void @objc_autoreleasePoolPop(i8*)
|
|
declare i8* @objc_autoreleasePoolPush()
|
|
declare i8* @objc_retainBlock(i8*)
|
|
|
|
declare i8* @objc_retainedObject(i8*)
|
|
declare i8* @objc_unretainedObject(i8*)
|
|
declare i8* @objc_unretainedPointer(i8*)
|
|
|
|
declare void @use_pointer(i8*)
|
|
declare void @callee()
|
|
declare void @callee_fnptr(void ()*)
|
|
declare void @invokee()
|
|
declare i8* @returner()
|
|
|
|
; Simple retain+release pair deletion, with some intervening control
|
|
; flow and harmless instructions.
|
|
|
|
; CHECK-LABEL: define void @test0(
|
|
; CHECK: entry:
|
|
; CHECK: call void @llvm.arc.annotation.bottomup.bbstart(i8** @x, i8** @S_None)
|
|
; CHECK: %0 = tail call i8* @objc_retain(i8* %a) #0, !llvm.arc.annotation.bottomup ![[ANN0:[0-9]+]], !llvm.arc.annotation.topdown ![[ANN1:[0-9]+]]
|
|
; CHECK: call void @llvm.arc.annotation.bottomup.bbend(i8** @x, i8** @S_Use)
|
|
; CHECK: call void @llvm.arc.annotation.topdown.bbend(i8** @x, i8** @S_Retain)
|
|
; CHECK: t:
|
|
; CHECK: call void @llvm.arc.annotation.topdown.bbstart(i8** @x, i8** @S_Retain)
|
|
; CHECK: call void @llvm.arc.annotation.bottomup.bbstart(i8** @x, i8** @S_Use)
|
|
; CHECK: store float 2.000000e+00, float* %b, !llvm.arc.annotation.bottomup ![[ANN2:[0-9]+]]
|
|
; CHECK: call void @llvm.arc.annotation.bottomup.bbend(i8** @x, i8** @S_Release)
|
|
; CHECK: call void @llvm.arc.annotation.topdown.bbend(i8** @x, i8** @S_Retain)
|
|
; CHECK: f:
|
|
; CHECK: call void @llvm.arc.annotation.topdown.bbstart(i8** @x, i8** @S_Retain)
|
|
; CHECK: call void @llvm.arc.annotation.bottomup.bbstart(i8** @x, i8** @S_Use)
|
|
; CHECK: store i32 7, i32* %x, !llvm.arc.annotation.bottomup ![[ANN2]]
|
|
; CHECK: call void @llvm.arc.annotation.bottomup.bbend(i8** @x, i8** @S_Release)
|
|
; CHECK: call void @llvm.arc.annotation.topdown.bbend(i8** @x, i8** @S_Retain)
|
|
; CHECK: return:
|
|
; CHECK: call void @llvm.arc.annotation.topdown.bbstart(i8** @x, i8** @S_Retain)
|
|
; CHECK: call void @llvm.arc.annotation.bottomup.bbstart(i8** @x, i8** @S_Release)
|
|
; CHECK: call void @objc_release(i8* %c) #0, !llvm.arc.annotation.bottomup ![[ANN3:[0-9]+]], !llvm.arc.annotation.topdown ![[ANN4:[0-9]+]]
|
|
; CHECK: call void @llvm.arc.annotation.topdown.bbend(i8** @x, i8** @S_None)
|
|
; CHECK: }
|
|
define void @test0(i32* %x, i1 %p) nounwind {
|
|
entry:
|
|
%a = bitcast i32* %x to i8*
|
|
%0 = call i8* @objc_retain(i8* %a) nounwind
|
|
br i1 %p, label %t, label %f
|
|
|
|
t:
|
|
store i8 3, i8* %a
|
|
%b = bitcast i32* %x to float*
|
|
store float 2.0, float* %b
|
|
br label %return
|
|
|
|
f:
|
|
store i32 7, i32* %x
|
|
br label %return
|
|
|
|
return:
|
|
%c = bitcast i32* %x to i8*
|
|
call void @objc_release(i8* %c) nounwind
|
|
ret void
|
|
}
|
|
|
|
!0 = !{}
|
|
|
|
; CHECK: ![[ANN0]] = !{!"(test0,%x)", !"S_Use", !"S_None"}
|
|
; CHECK: ![[ANN1]] = !{!"(test0,%x)", !"S_None", !"S_Retain"}
|
|
; CHECK: ![[ANN2]] = !{!"(test0,%x)", !"S_Release", !"S_Use"}
|
|
; CHECK: ![[ANN3]] = !{!"(test0,%x)", !"S_None", !"S_Release"}
|
|
; CHECK: ![[ANN4]] = !{!"(test0,%x)", !"S_Retain", !"S_None"}
|
|
|