Skip to content

Commit ecdd431

Browse files
authored
[flang][OpenMP] Add TODO and namespace for duplicate utils (#99)
Adds a TODO for the duplicated utils that we had to copy for do concurrent mapping. Also introduces the duplicate utils in a separate `internal` namespace to avoid naming conflicts.
1 parent a400728 commit ecdd431

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

flang/lib/Optimizer/Transforms/DoConcurrentConversion.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ namespace fir {
3737
namespace Fortran {
3838
namespace lower {
3939
namespace omp {
40+
namespace internal {
41+
// TODO The following 2 functions are copied from "flang/Lower/OpenMP/Utils.h".
42+
// This duplication is temporary until we find a solution for a shared location
43+
// for these utils that does not introduce circular CMake deps.
4044
mlir::omp::MapInfoOp
4145
createMapInfoOp(mlir::OpBuilder &builder, mlir::Location loc,
4246
mlir::Value baseAddr, mlir::Value varPtrPtr, std::string name,
@@ -139,6 +143,7 @@ mlir::Value calculateTripCount(fir::FirOpBuilder &builder, mlir::Location loc,
139143

140144
return tripCount;
141145
}
146+
} // namespace internal
142147
} // namespace omp
143148
} // namespace lower
144149
} // namespace Fortran
@@ -219,8 +224,8 @@ class DoConcurrentConversion : public mlir::OpConversionPattern<fir::DoLoopOp> {
219224
collapseClauseOps.loopStepVar.push_back(stepOp->getResult(0));
220225

221226
mlir::cast<mlir::omp::TargetOp>(targetOp).getTripCountMutable().assign(
222-
Fortran::lower::omp::calculateTripCount(firBuilder, doLoop.getLoc(),
223-
collapseClauseOps));
227+
Fortran::lower::omp::internal::calculateTripCount(
228+
firBuilder, doLoop.getLoc(), collapseClauseOps));
224229
}
225230

226231
rewriter.eraseOp(doLoop);
@@ -337,7 +342,7 @@ class DoConcurrentConversion : public mlir::OpConversionPattern<fir::DoLoopOp> {
337342
llvm::SmallVector<mlir::Value> boundsOps;
338343
genBoundsOps(rewriter, liveIn.getLoc(), declareOp, boundsOps);
339344

340-
return Fortran::lower::omp::createMapInfoOp(
345+
return Fortran::lower::omp ::internal::createMapInfoOp(
341346
rewriter, liveIn.getLoc(), declareOp.getBase(), /*varPtrPtr=*/{},
342347
declareOp.getUniqName().str(), boundsOps, /*members=*/{},
343348
/*membersIndex=*/mlir::DenseIntElementsAttr{},

0 commit comments

Comments
 (0)