[llvm] e1895a4 - OpenMP: add allocsize(0) attribute to __kmpc_alloc_shared
Augie Fackler via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 4 13:26:09 PST 2022
Author: Augie Fackler
Date: 2022-03-04T16:26:03-05:00
New Revision: e1895a46dc45e8e60554cd62de4c3aae35b9fe19
URL: https://github.com/llvm/llvm-project/commit/e1895a46dc45e8e60554cd62de4c3aae35b9fe19
DIFF: https://github.com/llvm/llvm-project/commit/e1895a46dc45e8e60554cd62de4c3aae35b9fe19.diff
LOG: OpenMP: add allocsize(0) attribute to __kmpc_alloc_shared
This is the second step in obviating two columns about allocation
functions in MemoryBuiltins.cpp.
Differential Revision: https://reviews.llvm.org/D119583
Added:
Modified:
llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
llvm/test/Transforms/OpenMP/spmdization.ll
Removed:
################################################################################
diff --git a/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def b/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
index 0c3cb3f43105a..b110eea959df6 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
+++ b/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
@@ -475,6 +475,7 @@ __OMP_RTL(__last, false, Void, )
#define ParamAttrs(...) ArrayRef<AttributeSet>({__VA_ARGS__})
#define EnumAttr(Kind) Attribute::get(Ctx, Attribute::AttrKind::Kind)
#define EnumAttrInt(Kind, N) Attribute::get(Ctx, Attribute::AttrKind::Kind, N)
+#define AllocSizeAttr(N, M) Attribute::getWithAllocSizeArgs(Ctx, N, M)
#define AttributeSet(...) \
AttributeSet::get(Ctx, ArrayRef<Attribute>({__VA_ARGS__}))
@@ -908,8 +909,10 @@ __OMP_RTL_ATTRS(__kmpc_doacross_wait, BarrierAttrs, AttributeSet(),
__OMP_RTL_ATTRS(__kmpc_doacross_fini, BarrierAttrs, AttributeSet(),
ParamAttrs(ReadOnlyPtrAttrs))
-__OMP_RTL_ATTRS(__kmpc_alloc_shared, DeviceAllocAttrs, ReturnPtrAttrs,
- ParamAttrs())
+__OMP_RTL_ATTRS(__kmpc_alloc_shared, AttributeSet(
+ EnumAttr(NoUnwind),
+ EnumAttr(NoSync),
+ AllocSizeAttr(0, None)), ReturnPtrAttrs, ParamAttrs())
__OMP_RTL_ATTRS(__kmpc_free_shared, DeviceAllocAttrs, AttributeSet(),
ParamAttrs(NoCaptureAttrs))
@@ -962,6 +965,7 @@ __OMP_RTL_ATTRS(__kmpc_parallel_51, AlwaysInlineAttrs, AttributeSet(),
#undef EnumAttr
#undef EnumAttrInt
#undef ParamAttrs
+#undef AllocSizeAttr
///}
diff --git a/llvm/test/Transforms/OpenMP/spmdization.ll b/llvm/test/Transforms/OpenMP/spmdization.ll
index 2166e01c01b8d..7ba9349256d61 100644
--- a/llvm/test/Transforms/OpenMP/spmdization.ll
+++ b/llvm/test/Transforms/OpenMP/spmdization.ll
@@ -2392,7 +2392,7 @@ attributes #11 = { convergent }
; AMDGPU: attributes #[[ATTR1]] = { convergent norecurse nounwind }
; AMDGPU: attributes #[[ATTR2]] = { nounwind }
; AMDGPU: attributes #[[ATTR3:[0-9]+]] = { nosync nounwind }
-; AMDGPU: attributes #[[ATTR4:[0-9]+]] = { nofree nosync nounwind }
+; AMDGPU: attributes #[[ATTR4:[0-9]+]] = { nofree nosync nounwind allocsize(0) }
; AMDGPU: attributes #[[ATTR5]] = { convergent "llvm.assume"="ompx_spmd_amenable" }
; AMDGPU: attributes #[[ATTR6]] = { convergent }
; AMDGPU: attributes #[[ATTR7:[0-9]+]] = { argmemonly nofree nosync nounwind willreturn }
@@ -2403,7 +2403,7 @@ attributes #11 = { convergent }
; NVPTX: attributes #[[ATTR1]] = { convergent norecurse nounwind }
; NVPTX: attributes #[[ATTR2]] = { nounwind }
; NVPTX: attributes #[[ATTR3:[0-9]+]] = { nosync nounwind }
-; NVPTX: attributes #[[ATTR4:[0-9]+]] = { nofree nosync nounwind }
+; NVPTX: attributes #[[ATTR4:[0-9]+]] = { nofree nosync nounwind allocsize(0) }
; NVPTX: attributes #[[ATTR5]] = { convergent "llvm.assume"="ompx_spmd_amenable" }
; NVPTX: attributes #[[ATTR6]] = { convergent }
; NVPTX: attributes #[[ATTR7:[0-9]+]] = { argmemonly nofree nosync nounwind willreturn }
@@ -2414,7 +2414,7 @@ attributes #11 = { convergent }
; AMDGPU-DISABLED: attributes #[[ATTR1]] = { convergent norecurse nounwind }
; AMDGPU-DISABLED: attributes #[[ATTR2]] = { nounwind }
; AMDGPU-DISABLED: attributes #[[ATTR3:[0-9]+]] = { nosync nounwind }
-; AMDGPU-DISABLED: attributes #[[ATTR4:[0-9]+]] = { nofree nosync nounwind }
+; AMDGPU-DISABLED: attributes #[[ATTR4:[0-9]+]] = { nofree nosync nounwind allocsize(0) }
; AMDGPU-DISABLED: attributes #[[ATTR5]] = { convergent "llvm.assume"="ompx_spmd_amenable" }
; AMDGPU-DISABLED: attributes #[[ATTR6]] = { convergent }
; AMDGPU-DISABLED: attributes #[[ATTR7:[0-9]+]] = { argmemonly nofree nosync nounwind willreturn }
@@ -2425,7 +2425,7 @@ attributes #11 = { convergent }
; NVPTX-DISABLED: attributes #[[ATTR1]] = { convergent norecurse nounwind }
; NVPTX-DISABLED: attributes #[[ATTR2]] = { nounwind }
; NVPTX-DISABLED: attributes #[[ATTR3:[0-9]+]] = { nosync nounwind }
-; NVPTX-DISABLED: attributes #[[ATTR4:[0-9]+]] = { nofree nosync nounwind }
+; NVPTX-DISABLED: attributes #[[ATTR4:[0-9]+]] = { nofree nosync nounwind allocsize(0) }
; NVPTX-DISABLED: attributes #[[ATTR5]] = { convergent "llvm.assume"="ompx_spmd_amenable" }
; NVPTX-DISABLED: attributes #[[ATTR6]] = { convergent }
; NVPTX-DISABLED: attributes #[[ATTR7:[0-9]+]] = { argmemonly nofree nosync nounwind willreturn }
More information about the llvm-commits
mailing list