diff --git a/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def b/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def --- a/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def +++ b/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def @@ -475,6 +475,7 @@ #define ParamAttrs(...) ArrayRef({__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({__VA_ARGS__})) @@ -908,8 +909,10 @@ __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)) diff --git a/llvm/test/Transforms/OpenMP/spmdization.ll b/llvm/test/Transforms/OpenMP/spmdization.ll --- a/llvm/test/Transforms/OpenMP/spmdization.ll +++ b/llvm/test/Transforms/OpenMP/spmdization.ll @@ -2392,7 +2392,7 @@ ; 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 @@ ; 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 @@ ; 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 @@ ; 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 }