[llvm] [OpenMP][OMPIRBuilder] Add support to omp target parallel (PR #67000)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 19 13:59:43 PDT 2023
================
@@ -1173,13 +1365,29 @@ IRBuilder<>::InsertPoint OpenMPIRBuilder::createParallel(
// Change the location to the outer alloca insertion point to create and
// initialize the allocas we pass into the parallel region.
Builder.restoreIP(OuterAllocaIP);
- AllocaInst *TIDAddr = Builder.CreateAlloca(Int32, nullptr, "tid.addr");
- AllocaInst *ZeroAddr = Builder.CreateAlloca(Int32, nullptr, "zero.addr");
+ AllocaInst *TIDAddrAlloca = Builder.CreateAlloca(Int32, nullptr, "tid.addr");
+ AllocaInst *ZeroAddrAlloca =
+ Builder.CreateAlloca(Int32, nullptr, "zero.addr");
+ Instruction *TIDAddr = TIDAddrAlloca;
+ Instruction *ZeroAddr = ZeroAddrAlloca;
+ if (ArgsInZeroAddressSpace && M.getDataLayout().getAllocaAddrSpace() != 0) {
+ // Add additional casts to enforce pointers in zero address spac
+ TIDAddr = new AddrSpaceCastInst(TIDAddrAlloca,
----------------
shraiysh wrote:
nit: Instead of using `new` here can we use `Builder.CreateAddrSpaceCast`? (same for ZeroAddr)
https://github.com/llvm/llvm-project/pull/67000
More information about the llvm-commits
mailing list