[llvm-branch-commits] [llvm] [mlir] [OpenMP][OMPIRBuilder] Use device shared memory for arg structures (PR #150925)
Michael Kruse via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Aug 19 03:30:55 PDT 2025
================
@@ -1850,25 +1870,22 @@ CallInst *CodeExtractor::emitReplacerCall(
if (StructValues.contains(output))
continue;
- AllocaInst *alloca = new AllocaInst(
- output->getType(), DL.getAllocaAddrSpace(), nullptr,
- output->getName() + ".loc", AllocaBlock->getFirstInsertionPt());
- params.push_back(alloca);
- ReloadOutputs.push_back(alloca);
+ Value *OutAlloc =
+ allocateVar(AllocaBlock, AllocaBlock->getFirstInsertionPt(),
+ output->getType(), output->getName() + ".loc");
+ params.push_back(OutAlloc);
+ ReloadOutputs.push_back(OutAlloc);
}
- AllocaInst *Struct = nullptr;
+ Instruction *Struct = nullptr;
if (!StructValues.empty()) {
- Struct = new AllocaInst(StructArgTy, DL.getAllocaAddrSpace(), nullptr,
- "structArg", AllocaBlock->getFirstInsertionPt());
- if (ArgsInZeroAddressSpace && DL.getAllocaAddrSpace() != 0) {
- auto *StructSpaceCast = new AddrSpaceCastInst(
- Struct, PointerType ::get(Context, 0), "structArg.ascast");
- StructSpaceCast->insertAfter(Struct->getIterator());
+ AddrSpaceCastInst *StructSpaceCast = nullptr;
+ Struct = allocateVar(AllocaBlock, AllocaBlock->getFirstInsertionPt(),
+ StructArgTy, "structArg", &StructSpaceCast);
+ if (StructSpaceCast)
params.push_back(StructSpaceCast);
- } else {
+ else
----------------
Meinersbur wrote:
My mistake: your patch also removes braces on the if part.
https://github.com/llvm/llvm-project/pull/150925
More information about the llvm-branch-commits
mailing list