mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
[Annotation] Allows annotation to carry some additional constant arguments.
This allows using annotation in a much more contexts than it currently has. especially when annotation with template or constexpr. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D88645
This commit is contained in:
parent
ce3aa09426
commit
1d03399e60
@ -953,11 +953,11 @@ def int_eh_sjlj_setup_dispatch : Intrinsic<[], []>;
|
||||
//
|
||||
def int_var_annotation : DefaultAttrsIntrinsic<[],
|
||||
[llvm_ptr_ty, llvm_ptr_ty,
|
||||
llvm_ptr_ty, llvm_i32_ty],
|
||||
llvm_ptr_ty, llvm_i32_ty, llvm_ptr_ty],
|
||||
[IntrWillReturn], "llvm.var.annotation">;
|
||||
def int_ptr_annotation : DefaultAttrsIntrinsic<[LLVMAnyPointerType<llvm_anyint_ty>],
|
||||
[LLVMMatchType<0>, llvm_ptr_ty, llvm_ptr_ty,
|
||||
llvm_i32_ty],
|
||||
llvm_i32_ty, llvm_ptr_ty],
|
||||
[IntrWillReturn], "llvm.ptr.annotation">;
|
||||
def int_annotation : DefaultAttrsIntrinsic<[llvm_anyint_ty],
|
||||
[LLVMMatchType<0>, llvm_ptr_ty,
|
||||
|
@ -15,8 +15,8 @@ define i32 @trivially_free() {
|
||||
; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.lifetime.start.p0i8(i64 1, i8* undef)
|
||||
; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.lifetime.end.p0i8(i64 1, i8* undef)
|
||||
; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a5 = call i64 @llvm.objectsize.i64.p0i8(i8* undef, i1 true, i1 true, i1 true)
|
||||
; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a6 = call i8* @llvm.ptr.annotation.p0i8(i8* undef, i8* undef, i8* undef, i32 undef)
|
||||
; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.var.annotation(i8* undef, i8* undef, i8* undef, i32 undef)
|
||||
; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a6 = call i8* @llvm.ptr.annotation.p0i8(i8* undef, i8* undef, i8* undef, i32 undef, i8* undef)
|
||||
; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.var.annotation(i8* undef, i8* undef, i8* undef, i32 undef, i8* undef)
|
||||
; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef
|
||||
;
|
||||
; CHECK-THROUGHPUT-LABEL: 'trivially_free'
|
||||
@ -31,8 +31,8 @@ define i32 @trivially_free() {
|
||||
; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.lifetime.start.p0i8(i64 1, i8* undef)
|
||||
; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.lifetime.end.p0i8(i64 1, i8* undef)
|
||||
; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a5 = call i64 @llvm.objectsize.i64.p0i8(i8* undef, i1 true, i1 true, i1 true)
|
||||
; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a6 = call i8* @llvm.ptr.annotation.p0i8(i8* undef, i8* undef, i8* undef, i32 undef)
|
||||
; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.var.annotation(i8* undef, i8* undef, i8* undef, i32 undef)
|
||||
; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a6 = call i8* @llvm.ptr.annotation.p0i8(i8* undef, i8* undef, i8* undef, i32 undef, i8* undef)
|
||||
; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.var.annotation(i8* undef, i8* undef, i8* undef, i32 undef, i8* undef)
|
||||
; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
|
||||
;
|
||||
%a0 = call i32 @llvm.annotation.i32(i32 undef, i8* undef, i8* undef, i32 undef)
|
||||
@ -49,8 +49,8 @@ define i32 @trivially_free() {
|
||||
call void @llvm.lifetime.start.p0i8(i64 1, i8* undef)
|
||||
call void @llvm.lifetime.end.p0i8(i64 1, i8* undef)
|
||||
%a5 = call i64 @llvm.objectsize.i64.p0i8(i8* undef, i1 1, i1 1, i1 1)
|
||||
%a6 = call i8* @llvm.ptr.annotation.p0i8(i8* undef, i8* undef, i8* undef, i32 undef)
|
||||
call void @llvm.var.annotation(i8* undef, i8* undef, i8* undef, i32 undef)
|
||||
%a6 = call i8* @llvm.ptr.annotation.p0i8(i8* undef, i8* undef, i8* undef, i32 undef, i8* undef)
|
||||
call void @llvm.var.annotation(i8* undef, i8* undef, i8* undef, i32 undef, i8* undef)
|
||||
ret i32 undef
|
||||
}
|
||||
|
||||
@ -68,8 +68,8 @@ declare i1 @llvm.is.constant.i32(i32)
|
||||
declare void @llvm.lifetime.start.p0i8(i64, i8*)
|
||||
declare void @llvm.lifetime.end.p0i8(i64, i8*)
|
||||
declare i64 @llvm.objectsize.i64.p0i8(i8*, i1, i1, i1)
|
||||
declare i8* @llvm.ptr.annotation.p0i8(i8*, i8*, i8*, i32)
|
||||
declare void @llvm.var.annotation(i8*, i8*, i8*, i32)
|
||||
declare i8* @llvm.ptr.annotation.p0i8(i8*, i8*, i8*, i32, i8*)
|
||||
declare void @llvm.var.annotation(i8*, i8*, i8*, i32, i8*)
|
||||
|
||||
|
||||
!0 = !DILocalVariable(scope: !1)
|
||||
|
@ -17,8 +17,8 @@ define i32 @trivially_free() {
|
||||
; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.lifetime.start.p0i8(i64 1, i8* undef)
|
||||
; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.lifetime.end.p0i8(i64 1, i8* undef)
|
||||
; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a5 = call i64 @llvm.objectsize.i64.p0i8(i8* undef, i1 true, i1 true, i1 true)
|
||||
; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a6 = call i8* @llvm.ptr.annotation.p0i8(i8* undef, i8* undef, i8* undef, i32 undef)
|
||||
; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.var.annotation(i8* undef, i8* undef, i8* undef, i32 undef)
|
||||
; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a6 = call i8* @llvm.ptr.annotation.p0i8(i8* undef, i8* undef, i8* undef, i32 undef, i8* undef)
|
||||
; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.var.annotation(i8* undef, i8* undef, i8* undef, i32 undef, i8* undef)
|
||||
; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef
|
||||
;
|
||||
; CHECK-THROUGHPUT-LABEL: 'trivially_free'
|
||||
@ -33,8 +33,8 @@ define i32 @trivially_free() {
|
||||
; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.lifetime.start.p0i8(i64 1, i8* undef)
|
||||
; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.lifetime.end.p0i8(i64 1, i8* undef)
|
||||
; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a5 = call i64 @llvm.objectsize.i64.p0i8(i8* undef, i1 true, i1 true, i1 true)
|
||||
; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a6 = call i8* @llvm.ptr.annotation.p0i8(i8* undef, i8* undef, i8* undef, i32 undef)
|
||||
; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.var.annotation(i8* undef, i8* undef, i8* undef, i32 undef)
|
||||
; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a6 = call i8* @llvm.ptr.annotation.p0i8(i8* undef, i8* undef, i8* undef, i32 undef, i8* undef)
|
||||
; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.var.annotation(i8* undef, i8* undef, i8* undef, i32 undef, i8* undef)
|
||||
; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef
|
||||
;
|
||||
%a0 = call i32 @llvm.annotation.i32(i32 undef, i8* undef, i8* undef, i32 undef)
|
||||
@ -51,8 +51,8 @@ define i32 @trivially_free() {
|
||||
call void @llvm.lifetime.start.p0i8(i64 1, i8* undef)
|
||||
call void @llvm.lifetime.end.p0i8(i64 1, i8* undef)
|
||||
%a5 = call i64 @llvm.objectsize.i64.p0i8(i8* undef, i1 1, i1 1, i1 1)
|
||||
%a6 = call i8* @llvm.ptr.annotation.p0i8(i8* undef, i8* undef, i8* undef, i32 undef)
|
||||
call void @llvm.var.annotation(i8* undef, i8* undef, i8* undef, i32 undef)
|
||||
%a6 = call i8* @llvm.ptr.annotation.p0i8(i8* undef, i8* undef, i8* undef, i32 undef, i8* undef)
|
||||
call void @llvm.var.annotation(i8* undef, i8* undef, i8* undef, i32 undef, i8* undef)
|
||||
ret i32 undef
|
||||
}
|
||||
|
||||
@ -70,8 +70,8 @@ declare i1 @llvm.is.constant.i32(i32)
|
||||
declare void @llvm.lifetime.start.p0i8(i64, i8*)
|
||||
declare void @llvm.lifetime.end.p0i8(i64, i8*)
|
||||
declare i64 @llvm.objectsize.i64.p0i8(i8*, i1, i1, i1)
|
||||
declare i8* @llvm.ptr.annotation.p0i8(i8*, i8*, i8*, i32)
|
||||
declare void @llvm.var.annotation(i8*, i8*, i8*, i32)
|
||||
declare i8* @llvm.ptr.annotation.p0i8(i8*, i8*, i8*, i32, i8*)
|
||||
declare void @llvm.var.annotation(i8*, i8*, i8*, i32, i8*)
|
||||
|
||||
|
||||
!0 = !DILocalVariable(scope: !1)
|
||||
|
@ -15,8 +15,8 @@ define i32 @trivially_free() {
|
||||
; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.lifetime.start.p0i8(i64 1, i8* undef)
|
||||
; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.lifetime.end.p0i8(i64 1, i8* undef)
|
||||
; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a5 = call i64 @llvm.objectsize.i64.p0i8(i8* undef, i1 true, i1 true, i1 true)
|
||||
; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a6 = call i8* @llvm.ptr.annotation.p0i8(i8* undef, i8* undef, i8* undef, i32 undef)
|
||||
; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.var.annotation(i8* undef, i8* undef, i8* undef, i32 undef)
|
||||
; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a6 = call i8* @llvm.ptr.annotation.p0i8(i8* undef, i8* undef, i8* undef, i32 undef, i8* undef)
|
||||
; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.var.annotation(i8* undef, i8* undef, i8* undef, i32 undef, i8* undef)
|
||||
; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef
|
||||
;
|
||||
; CHECK-THROUGHPUT-LABEL: 'trivially_free'
|
||||
@ -31,8 +31,8 @@ define i32 @trivially_free() {
|
||||
; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.lifetime.start.p0i8(i64 1, i8* undef)
|
||||
; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.lifetime.end.p0i8(i64 1, i8* undef)
|
||||
; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a5 = call i64 @llvm.objectsize.i64.p0i8(i8* undef, i1 true, i1 true, i1 true)
|
||||
; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a6 = call i8* @llvm.ptr.annotation.p0i8(i8* undef, i8* undef, i8* undef, i32 undef)
|
||||
; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.var.annotation(i8* undef, i8* undef, i8* undef, i32 undef)
|
||||
; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a6 = call i8* @llvm.ptr.annotation.p0i8(i8* undef, i8* undef, i8* undef, i32 undef, i8* undef)
|
||||
; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.var.annotation(i8* undef, i8* undef, i8* undef, i32 undef, i8* undef)
|
||||
; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef
|
||||
;
|
||||
%a0 = call i32 @llvm.annotation.i32(i32 undef, i8* undef, i8* undef, i32 undef)
|
||||
@ -49,8 +49,8 @@ define i32 @trivially_free() {
|
||||
call void @llvm.lifetime.start.p0i8(i64 1, i8* undef)
|
||||
call void @llvm.lifetime.end.p0i8(i64 1, i8* undef)
|
||||
%a5 = call i64 @llvm.objectsize.i64.p0i8(i8* undef, i1 1, i1 1, i1 1)
|
||||
%a6 = call i8* @llvm.ptr.annotation.p0i8(i8* undef, i8* undef, i8* undef, i32 undef)
|
||||
call void @llvm.var.annotation(i8* undef, i8* undef, i8* undef, i32 undef)
|
||||
%a6 = call i8* @llvm.ptr.annotation.p0i8(i8* undef, i8* undef, i8* undef, i32 undef, i8* undef)
|
||||
call void @llvm.var.annotation(i8* undef, i8* undef, i8* undef, i32 undef, i8* undef)
|
||||
ret i32 undef
|
||||
}
|
||||
|
||||
@ -68,8 +68,8 @@ declare i1 @llvm.is.constant.i32(i32)
|
||||
declare void @llvm.lifetime.start.p0i8(i64, i8*)
|
||||
declare void @llvm.lifetime.end.p0i8(i64, i8*)
|
||||
declare i64 @llvm.objectsize.i64.p0i8(i8*, i1, i1, i1)
|
||||
declare i8* @llvm.ptr.annotation.p0i8(i8*, i8*, i8*, i32)
|
||||
declare void @llvm.var.annotation(i8*, i8*, i8*, i32)
|
||||
declare i8* @llvm.ptr.annotation.p0i8(i8*, i8*, i8*, i32, i8*)
|
||||
declare void @llvm.var.annotation(i8*, i8*, i8*, i32, i8*)
|
||||
|
||||
|
||||
!0 = !DILocalVariable(scope: !1)
|
||||
|
@ -10,9 +10,9 @@
|
||||
define void @foo() {
|
||||
entry:
|
||||
%m = alloca i8, align 4
|
||||
%0 = call i8* @llvm.ptr.annotation.p0i8(i8* %m, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str1, i32 0, i32 0), i32 2)
|
||||
%0 = call i8* @llvm.ptr.annotation.p0i8(i8* %m, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str1, i32 0, i32 0), i32 2, i8* null)
|
||||
store i8 1, i8* %0, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
declare i8* @llvm.ptr.annotation.p0i8(i8*, i8*, i8*, i32) #1
|
||||
declare i8* @llvm.ptr.annotation.p0i8(i8*, i8*, i8*, i32, i8*) #1
|
||||
|
@ -15,7 +15,7 @@ define i32 @assume_inevitable(i32* %a, i32* %b, i8* %c) {
|
||||
; CHECK-NEXT: [[DUMMY_EQ:%.*]] = icmp ugt i32 [[LOADRES]], 42
|
||||
; CHECK-NEXT: tail call void @llvm.assume(i1 [[DUMMY_EQ]])
|
||||
; CHECK-NEXT: [[M_I8:%.*]] = bitcast i64* [[M]] to i8*
|
||||
; CHECK-NEXT: [[M_A:%.*]] = call i8* @llvm.ptr.annotation.p0i8(i8* nonnull [[M_I8]], i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str1, i64 0, i64 0), i32 2)
|
||||
; CHECK-NEXT: [[M_A:%.*]] = call i8* @llvm.ptr.annotation.p0i8(i8* nonnull [[M_I8]], i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str1, i64 0, i64 0), i32 2, i8* null)
|
||||
; CHECK-NEXT: [[M_X:%.*]] = bitcast i8* [[M_A]] to i64*
|
||||
; CHECK-NEXT: [[OBJSZ:%.*]] = call i64 @llvm.objectsize.i64.p0i8(i8* [[C:%.*]], i1 false, i1 false, i1 false)
|
||||
; CHECK-NEXT: store i64 [[OBJSZ]], i64* [[M_X]], align 4
|
||||
@ -44,7 +44,7 @@ entry:
|
||||
call void @llvm.lifetime.end.p0i8(i64 1, i8* %dummy)
|
||||
|
||||
%m_i8 = bitcast i64* %m to i8*
|
||||
%m_a = call i8* @llvm.ptr.annotation.p0i8(i8* %m_i8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str1, i32 0, i32 0), i32 2)
|
||||
%m_a = call i8* @llvm.ptr.annotation.p0i8(i8* %m_i8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str1, i32 0, i32 0), i32 2, i8* null)
|
||||
%m_x = bitcast i8* %m_a to i64*
|
||||
%objsz = call i64 @llvm.objectsize.i64.p0i8(i8* %c, i1 false)
|
||||
store i64 %objsz, i64* %m_x
|
||||
@ -64,7 +64,7 @@ entry:
|
||||
|
||||
declare i64 @llvm.objectsize.i64.p0i8(i8*, i1)
|
||||
declare i32 @llvm.annotation.i32(i32, i8*, i8*, i32)
|
||||
declare i8* @llvm.ptr.annotation.p0i8(i8*, i8*, i8*, i32)
|
||||
declare i8* @llvm.ptr.annotation.p0i8(i8*, i8*, i8*, i32, i8*)
|
||||
|
||||
declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
|
||||
declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
|
||||
|
Loading…
Reference in New Issue
Block a user