8000 [flang][OpenMP][NFC] Further refactoring for `genOpWithBody` & by ergawy · Pull Request #80839 · llvm/llvm-project · GitHub
[go: up one dir, main page]

Skip to content

[flang][OpenMP][NFC] Further refactoring for genOpWithBody & #80839

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

Merged
merged 3 commits into from
Feb 7, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Review comments.
  • Loading branch information
ergawy committed Feb 6, 2024
commit f89807132b5897259c2a4cc8694a35d36d4e152c
20 changes: 10 additions & 10 deletions flang/lib/Lower/OpenMP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2327,7 +2327,7 @@ struct OpWithBodyGenInfo {
/// \param [in] op - the operation the body belongs to.
/// \param [in] info - options controlling code-gen for the construction.
template <typename Op>
static void createBodyOfOp(Op &op, OpWithBodyGenInfo info) {
static void createBodyOfOp(Op &op, OpWithBodyGenInfo &info) {
fir::FirOpBuilder &firOpBuilder = info.converter.getFirOpBuilder();

auto insertMarker = [](fir::FirOpBuilder &builder) {
Expand Down Expand Up @@ -2523,7 +2523,7 @@ static void genBodyOfTargetDataOp(
}

template <typename OpTy, typename... Args>
static OpTy genOpWithBody(OpWithBodyGenInfo info, Args &&...args) {
static OpTy genOpWithBody(OpWithBodyGenInfo &info, Args &&...args) {
auto op = info.converter.getFirOpBuilder().create<OpTy>(
info.loc, std::forward<Args>(args)...);
createBodyOfOp<OpTy>(op, info);
Expand Down Expand Up @@ -3264,10 +3264,10 @@ static void convertLoopBounds(Fortran::lower::AbstractConverter &converter,
}
}

static llvm::SmallVector<const Fortran::semantics::Symbol *> genCodeForIterVar(
mlir::Operation *op, Fortran::lower::AbstractConverter &converter,
mlir::Location &loc,
const llvm::SmallVector<const Fortran::semantics::Symbol *> &args) {
static llvm::SmallVector<const Fortran::semantics::Symbol *>
genLoopVars(mlir::Operation *op, Fortran::lower::AbstractConverter &converter,
mlir::Location &loc,
const llvm::SmallVector<const Fortran::semantics::Symbol *> &args) {
fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder();
auto &region = op->getRegion(0);

Expand Down Expand Up @@ -3340,7 +3340,7 @@ createSimdLoop(Fortran::lower::AbstractConverter &converter,
eval, Fortran::lower::getCollapseValue(loopOpClauseList));

auto ivCallback = [&](mlir::Operation *op) {
return genCodeForIterVar(op, converter, loc, iv);
return genLoopVars(op, converter, loc, iv);
};

createBodyOfOp<mlir::omp::SimdLoopOp>(
Expand Down Expand Up @@ -3422,7 +3422,7 @@ static void createWsLoop(Fortran::lower::AbstractConverter &converter,
eval, Fortran::lower::getCollapseValue(beginClauseList));

auto ivCallback = [&](mlir::Operation *op) {
return genCodeForIterVar(op, converter, loc, iv);
return genLoopVars(op, converter, loc, iv);
};

createBodyOfOp<mlir::omp::WsLoopOp>(
Expand Down Expand Up @@ -3710,8 +3710,8 @@ genOMP(Fortran::lower::AbstractConverter &converter,
currentLocation, mlir::FlatSymbolRefAttr::get(firOpBuilder.getContext(),
global.getSymName()));
}();
createBodyOfOp<mlir::omp::CriticalOp>(
criticalOp, OpWithBodyGenInfo(converter, currentLocation, eval));
auto genInfo = OpWithBodyGenInfo(converter, currentLocation, eval);
createBodyOfOp<mlir::omp::CriticalOp>(criticalOp, genInfo);
}

static void
Expand Down
0