@@ -480,12 +480,11 @@ makeReductionGen(omp::DeclareReductionOp decl, llvm::IRBuilderBase &builder,
480480 [&, decl](llvm::OpenMPIRBuilder::InsertPointTy insertPoint,
481481 llvm::Value *lhs, llvm::Value *rhs,
482482 llvm::Value *&result) mutable {
483- Region &reductionRegion = decl.getReductionRegion ();
484- moduleTranslation.mapValue (reductionRegion.front ().getArgument (0 ), lhs);
485- moduleTranslation.mapValue (reductionRegion.front ().getArgument (1 ), rhs);
483+ moduleTranslation.mapValue (decl.getReductionLhsArg (), lhs);
484+ moduleTranslation.mapValue (decl.getReductionRhsArg (), rhs);
486485 builder.restoreIP (insertPoint);
487486 SmallVector<llvm::Value *> phis;
488- if (failed (inlineConvertOmpRegions (reductionRegion ,
487+ if (failed (inlineConvertOmpRegions (decl. getReductionRegion () ,
489488 " omp.reduction.nonatomic.body" ,
490489 builder, moduleTranslation, &phis)))
491490 return llvm::OpenMPIRBuilder::InsertPointTy ();
@@ -513,12 +512,11 @@ makeAtomicReductionGen(omp::DeclareReductionOp decl,
513512 OwningAtomicReductionGen atomicGen =
514513 [&, decl](llvm::OpenMPIRBuilder::InsertPointTy insertPoint, llvm::Type *,
515514 llvm::Value *lhs, llvm::Value *rhs) mutable {
516- Region &atomicRegion = decl.getAtomicReductionRegion ();
517- moduleTranslation.mapValue (atomicRegion.front ().getArgument (0 ), lhs);
518- moduleTranslation.mapValue (atomicRegion.front ().getArgument (1 ), rhs);
515+ moduleTranslation.mapValue (decl.getAtomicReductionLhsArg (), lhs);
516+ moduleTranslation.mapValue (decl.getAtomicReductionRhsArg (), rhs);
519517 builder.restoreIP (insertPoint);
520518 SmallVector<llvm::Value *> phis;
521- if (failed (inlineConvertOmpRegions (atomicRegion ,
519+ if (failed (inlineConvertOmpRegions (decl. getAtomicReductionRegion () ,
522520 " omp.reduction.atomic.body" , builder,
523521 moduleTranslation, &phis)))
524522 return llvm::OpenMPIRBuilder::InsertPointTy ();
@@ -1674,9 +1672,10 @@ convertOmpParallel(omp::ParallelOp opInst, llvm::IRBuilderBase &builder,
16741672 // argument of the `alloc` region and the second argument of the `copy`
16751673 // region to be the yielded value of the `alloc` region (this is the
16761674 // private clone of the privatized value).
1677- copyCloneBuilder.mergeBlocks (
1678- &*newCopyRegionFrontBlock, &*oldAllocBackBlock,
1679- {allocRegion.getArgument (0 ), oldAllocYieldOp.getOperand (0 )});
1675+ copyCloneBuilder.mergeBlocks (&*newCopyRegionFrontBlock,
1676+ &*oldAllocBackBlock,
1677+ {mlirPrivatizerClone.getAllocMoldArg (),
1678+ oldAllocYieldOp.getOperand (0 )});
16801679
16811680 // 4. The old terminator of the `alloc` region is not needed anymore, so
16821681 // delete it.
@@ -1686,8 +1685,8 @@ convertOmpParallel(omp::ParallelOp opInst, llvm::IRBuilderBase &builder,
16861685 // Replace the privatizer block argument with mlir value being privatized.
16871686 // This way, the body of the privatizer will be changed from using the
16881687 // region/block argument to the value being privatized.
1689- auto allocRegionArg = allocRegion. getArgument ( 0 );
1690- replaceAllUsesInRegionWith (allocRegionArg, mlirPrivVar, allocRegion);
1688+ replaceAllUsesInRegionWith (mlirPrivatizerClone. getAllocMoldArg (),
1689+ mlirPrivVar, allocRegion);
16911690
16921691 auto oldIP = builder.saveIP ();
16931692 builder.restoreIP (allocaIP);
@@ -3480,10 +3479,9 @@ convertOmpTarget(Operation &opInst, llvm::IRBuilderBase &builder,
34803479 " private allocatables is not supported yet" );
34813480 bodyGenStatus = failure ();
34823481 } else {
3483- Region &allocRegion = privatizer.getAllocRegion ();
3484- BlockArgument allocRegionArg = allocRegion.getArgument (0 );
3485- moduleTranslation.mapValue (allocRegionArg,
3482+ moduleTranslation.mapValue (privatizer.getAllocMoldArg (),
34863483 moduleTranslation.lookupValue (privVar));
3484+ Region &allocRegion = privatizer.getAllocRegion ();
34873485 SmallVector<llvm::Value *, 1 > yieldedValues;
34883486 if (failed (inlineConvertOmpRegions (
34893487 allocRegion, " omp.targetop.privatizer" , builder,
0 commit comments