diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2022-12-09 13:22:12 -0500 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2022-12-09 13:22:12 -0500 |
commit | 41c96e94835df372ccdb6ad4df07b7bfaf257b51 (patch) | |
tree | a2b7af19c7f2aa5e2917e43d9904f069b7e62636 /llvm/lib | |
parent | 7ea80c279f59b0567d26c77155d982b5d6ce1c81 (diff) | |
download | llvm-41c96e94835df372ccdb6ad4df07b7bfaf257b51.zip llvm-41c96e94835df372ccdb6ad4df07b7bfaf257b51.tar.gz llvm-41c96e94835df372ccdb6ad4df07b7bfaf257b51.tar.bz2 |
AMDGPU: Fix not emitting code for exotic constructor types
This was simply ignoring any entries that weren't direct function
calls. This really should have been erroring on anything
unexpected. We should be able to handle calling just about anything
these days, so just call anything.
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPUCtorDtorLowering.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUCtorDtorLowering.cpp b/llvm/lib/Target/AMDGPU/AMDGPUCtorDtorLowering.cpp index 40476ce..92399c3 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUCtorDtorLowering.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUCtorDtorLowering.cpp @@ -56,16 +56,17 @@ public: ConstantArray *GA = dyn_cast<ConstantArray>(GV->getInitializer()); if (!GA || GA->getNumOperands() == 0) return false; + Function *InitOrFiniKernel = createInitOrFiniKernelFunction(M, IsCtor); IRBuilder<> IRB(InitOrFiniKernel->getEntryBlock().getTerminator()); + + FunctionType *ConstructorTy = InitOrFiniKernel->getFunctionType(); + for (Value *V : GA->operands()) { auto *CS = cast<ConstantStruct>(V); - if (Function *F = dyn_cast<Function>(CS->getOperand(1))) { - FunctionCallee Ctor = - M.getOrInsertFunction(F->getName(), IRB.getVoidTy()); - IRB.CreateCall(Ctor); - } + IRB.CreateCall(ConstructorTy, CS->getOperand(1)); } + appendToUsed(M, {InitOrFiniKernel}); return true; } |