Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[flang][OpenMP] Add TODO and namespace for duplicate utils #99

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions flang/lib/Optimizer/Transforms/DoConcurrentConversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ namespace fir {
namespace Fortran {
namespace lower {
namespace omp {
namespace internal {
// TODO The following 2 functions are copied from "flang/Lower/OpenMP/Utils.h".
// This duplication is temporary until we find a solution for a shared location
// for these utils that does not introduce circular CMake deps.
mlir::omp::MapInfoOp
createMapInfoOp(mlir::OpBuilder &builder, mlir::Location loc,
mlir::Value baseAddr, mlir::Value varPtrPtr, std::string name,
Expand Down Expand Up @@ -139,6 +143,7 @@ mlir::Value calculateTripCount(fir::FirOpBuilder &builder, mlir::Location loc,

return tripCount;
}
} // namespace internal
} // namespace omp
} // namespace lower
} // namespace Fortran
Expand Down Expand Up @@ -219,8 +224,8 @@ class DoConcurrentConversion : public mlir::OpConversionPattern<fir::DoLoopOp> {
collapseClauseOps.loopStepVar.push_back(stepOp->getResult(0));

mlir::cast<mlir::omp::TargetOp>(targetOp).getTripCountMutable().assign(
Fortran::lower::omp::calculateTripCount(firBuilder, doLoop.getLoc(),
collapseClauseOps));
Fortran::lower::omp::internal::calculateTripCount(
firBuilder, doLoop.getLoc(), collapseClauseOps));
}

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

return Fortran::lower::omp::createMapInfoOp(
return Fortran::lower::omp ::internal::createMapInfoOp(
rewriter, liveIn.getLoc(), declareOp.getBase(), /*varPtrPtr=*/{},
declareOp.getUniqName().str(), boundsOps, /*members=*/{},
/*membersIndex=*/mlir::DenseIntElementsAttr{},
Expand Down