[llvm-branch-commits] [flang] [mlir] [mlir][OpenMP][flang] make private variable allocation implicit in omp.private (PR #124019)
Tom Eccles via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Jan 23 07:21:34 PST 2025
================
@@ -488,44 +559,34 @@ void DataSharingProcessor::doPrivatize(const semantics::Symbol *sym,
mlir::OpBuilder::InsertionGuard guard(firOpBuilder);
firOpBuilder.setInsertionPointToStart(moduleOp.getBody());
auto result = firOpBuilder.create<mlir::omp::PrivateClauseOp>(
- symLoc, uniquePrivatizerName, symType,
+ symLoc, uniquePrivatizerName, allocType,
isFirstPrivate ? mlir::omp::DataSharingClauseType::FirstPrivate
: mlir::omp::DataSharingClauseType::Private);
fir::ExtendedValue symExV = converter.getSymbolExtendedValue(*sym);
lower::SymMapScope outerScope(symTable);
- // Populate the `alloc` region.
- {
- mlir::Region &allocRegion = result.getAllocRegion();
- mlir::Block *allocEntryBlock = firOpBuilder.createBlock(
- &allocRegion, /*insertPt=*/{}, symType, symLoc);
-
- firOpBuilder.setInsertionPointToEnd(allocEntryBlock);
-
- fir::ExtendedValue localExV =
- hlfir::translateToExtendedValue(
- symLoc, firOpBuilder, hlfir::Entity{allocRegion.getArgument(0)},
- /*contiguousHint=*/
- evaluate::IsSimplyContiguous(*sym, converter.getFoldingContext()))
- .first;
-
- symTable.addSymbol(*sym, localExV);
- lower::SymMapScope innerScope(symTable);
- cloneSymbol(sym);
- mlir::Value cloneAddr = symTable.shallowLookupSymbol(*sym).getAddr();
- mlir::Type cloneType = cloneAddr.getType();
-
- // A `convert` op is required for variables that are storage associated
- // via `equivalence`. The problem is that these variables are declared as
- // `fir.ptr`s while their privatized storage is declared as `fir.ref`,
- // therefore we convert to proper symbol type.
- mlir::Value yieldedValue =
- (symType == cloneType) ? cloneAddr
- : firOpBuilder.createConvert(
- cloneAddr.getLoc(), symType, cloneAddr);
-
- firOpBuilder.create<mlir::omp::YieldOp>(hsb.getAddr().getLoc(),
- yieldedValue);
+ // Populate the `init` region.
+ const bool needsInitialization =
----------------
tblah wrote:
Done in [7cb83e3](https://github.com/llvm/llvm-project/pull/124019/commits/7cb83e335cfd25ab750e8c15c951dfb9198ac7a1)
https://github.com/llvm/llvm-project/pull/124019
More information about the llvm-branch-commits
mailing list