diff --git a/llvm/lib/Target/AMDGPU/AMDGPUCtorDtorLowering.cpp b/llvm/lib/Target/AMDGPU/AMDGPUCtorDtorLowering.cpp --- a/llvm/lib/Target/AMDGPU/AMDGPUCtorDtorLowering.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUCtorDtorLowering.cpp @@ -38,6 +38,7 @@ FunctionType::get(Type::getVoidTy(M.getContext()), false), GlobalValue::WeakODRLinkage, 0, InitOrFiniKernelName, &M); InitOrFiniKernel->setCallingConv(CallingConv::AMDGPU_KERNEL); + InitOrFiniKernel->addFnAttr("amdgpu-flat-work-group-size", "1,1"); if (IsCtor) InitOrFiniKernel->addFnAttr("device-init"); else @@ -58,6 +59,7 @@ // void call_init_array_callbacks() { // for (auto start = __init_array_start; start != __init_array_end; ++start) // reinterpret_cast(*start)(); +// } static void createInitOrFiniCalls(Function &F, bool IsCtor) { Module &M = *F.getParent(); LLVMContext &C = M.getContext(); diff --git a/llvm/test/CodeGen/AMDGPU/lower-ctor-dtor-constexpr-alias.ll b/llvm/test/CodeGen/AMDGPU/lower-ctor-dtor-constexpr-alias.ll --- a/llvm/test/CodeGen/AMDGPU/lower-ctor-dtor-constexpr-alias.ll +++ b/llvm/test/CodeGen/AMDGPU/lower-ctor-dtor-constexpr-alias.ll @@ -64,5 +64,5 @@ ; CHECK: while.end: ; CHECK-NEXT: ret void -; CHECK: attributes #[[ATTR0:[0-9]+]] = { "device-init" } -; CHECK: attributes #[[ATTR1:[0-9]+]] = { "device-fini" } +; CHECK: attributes #[[ATTR0:[0-9]+]] = { "amdgpu-flat-work-group-size"="1,1" "device-init" } +; CHECK: attributes #[[ATTR1:[0-9]+]] = { "amdgpu-flat-work-group-size"="1,1" "device-fini" } diff --git a/llvm/test/CodeGen/AMDGPU/lower-ctor-dtor.ll b/llvm/test/CodeGen/AMDGPU/lower-ctor-dtor.ll --- a/llvm/test/CodeGen/AMDGPU/lower-ctor-dtor.ll +++ b/llvm/test/CodeGen/AMDGPU/lower-ctor-dtor.ll @@ -58,5 +58,5 @@ ret void } -; CHECK: attributes #0 = { "device-init" } -; CHECK: attributes #1 = { "device-fini" } +; CHECK: attributes #0 = { "amdgpu-flat-work-group-size"="1,1" "device-init" } +; CHECK: attributes #1 = { "amdgpu-flat-work-group-size"="1,1" "device-fini" } diff --git a/llvm/test/CodeGen/AMDGPU/lower-multiple-ctor-dtor.ll b/llvm/test/CodeGen/AMDGPU/lower-multiple-ctor-dtor.ll --- a/llvm/test/CodeGen/AMDGPU/lower-multiple-ctor-dtor.ll +++ b/llvm/test/CodeGen/AMDGPU/lower-multiple-ctor-dtor.ll @@ -57,5 +57,5 @@ ret void } -; CHECK: attributes #0 = { "device-init" } -; CHECK: attributes #1 = { "device-fini" } +; CHECK: attributes #0 = { "amdgpu-flat-work-group-size"="1,1" "device-init" } +; CHECK: attributes #1 = { "amdgpu-flat-work-group-size"="1,1" "device-fini" }