@@ -480,12 +480,11 @@ makeReductionGen(omp::DeclareReductionOp decl, llvm::IRBuilderBase &builder,
480
480
[&, decl](llvm::OpenMPIRBuilder::InsertPointTy insertPoint,
481
481
llvm::Value *lhs, llvm::Value *rhs,
482
482
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);
486
485
builder.restoreIP (insertPoint);
487
486
SmallVector<llvm::Value *> phis;
488
- if (failed (inlineConvertOmpRegions (reductionRegion ,
487
+ if (failed (inlineConvertOmpRegions (decl. getReductionRegion () ,
489
488
" omp.reduction.nonatomic.body" ,
490
489
builder, moduleTranslation, &phis)))
491
490
return llvm::OpenMPIRBuilder::InsertPointTy ();
@@ -513,12 +512,11 @@ makeAtomicReductionGen(omp::DeclareReductionOp decl,
513
512
OwningAtomicReductionGen atomicGen =
514
513
[&, decl](llvm::OpenMPIRBuilder::InsertPointTy insertPoint, llvm::Type *,
515
514
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);
519
517
builder.restoreIP (insertPoint);
520
518
SmallVector<llvm::Value *> phis;
521
- if (failed (inlineConvertOmpRegions (atomicRegion ,
519
+ if (failed (inlineConvertOmpRegions (decl. getAtomicReductionRegion () ,
522
520
" omp.reduction.atomic.body" , builder,
523
521
moduleTranslation, &phis)))
524
522
return llvm::OpenMPIRBuilder::InsertPointTy ();
@@ -1674,9 +1672,10 @@ convertOmpParallel(omp::ParallelOp opInst, llvm::IRBuilderBase &builder,
1674
1672
// argument of the `alloc` region and the second argument of the `copy`
1675
1673
// region to be the yielded value of the `alloc` region (this is the
1676
1674
// 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 )});
1680
1679
1681
1680
// 4. The old terminator of the `alloc` region is not needed anymore, so
1682
1681
// delete it.
@@ -1686,8 +1685,8 @@ convertOmpParallel(omp::ParallelOp opInst, llvm::IRBuilderBase &builder,
1686
1685
// Replace the privatizer block argument with mlir value being privatized.
1687
1686
// This way, the body of the privatizer will be changed from using the
1688
1687
// 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);
1691
1690
1692
1691
auto oldIP = builder.saveIP ();
1693
1692
builder.restoreIP (allocaIP);
@@ -3480,10 +3479,9 @@ convertOmpTarget(Operation &opInst, llvm::IRBuilderBase &builder,
3480
3479
" private allocatables is not supported yet" );
3481
3480
bodyGenStatus = failure ();
3482
3481
} else {
3483
- Region &allocRegion = privatizer.getAllocRegion ();
3484
- BlockArgument allocRegionArg = allocRegion.getArgument (0 );
3485
- moduleTranslation.mapValue (allocRegionArg,
3482
+ moduleTranslation.mapValue (privatizer.getAllocMoldArg (),
3486
3483
moduleTranslation.lookupValue (privVar));
3484
+ Region &allocRegion = privatizer.getAllocRegion ();
3487
3485
SmallVector<llvm::Value *, 1 > yieldedValues;
3488
3486
if (failed (inlineConvertOmpRegions (
3489
3487
allocRegion, " omp.targetop.privatizer" , builder,
0 commit comments