Skip to content

[flang][fir] Small clean-up in fir_DoConcurrentLoopOp's defintion #146028

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

Open
wants to merge 1 commit into
base: users/ergawy/convert_locality_specs_to_clauses_6
Choose a base branch
from
Open
Show file tree
Hide file tree
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
22 changes: 10 additions & 12 deletions flang/include/flang/Optimizer/Dialect/FIROps.td
Original file line number Diff line number Diff line change
Expand Up @@ -3884,9 +3884,17 @@ def fir_DoConcurrentLoopOp : fir_Op<"do_concurrent.loop",
let hasVerifier = 1;

let extraClassDeclaration = [{
unsigned getNumInductionVars() { return getLowerBound().size(); }
unsigned getNumInductionVars() {
return getLowerBound().size();
}

unsigned getNumLocalOperands() { return getLocalVars().size(); }
unsigned getNumLocalOperands() {
return getLocalVars().size();
}

unsigned getNumReduceOperands() {
return getReduceVars().size();
}

mlir::Block::BlockArgListType getInductionVars() {
return getBody()->getArguments().slice(0, getNumInductionVars());
Expand All @@ -3906,16 +3914,6 @@ def fir_DoConcurrentLoopOp : fir_Op<"do_concurrent.loop",
/// Number of operands controlling the loop
unsigned getNumControlOperands() { return getLowerBound().size() * 3; }

// Get Number of reduction operands
unsigned getNumReduceOperands() {
return getReduceVars().size();
}

mlir::Operation::operand_range getLocalOperands() {
return getOperands()
.slice(getNumControlOperands() + getNumReduceOperands(),
getNumLocalOperands());
}
}];
}

Expand Down
4 changes: 2 additions & 2 deletions flang/lib/Optimizer/OpenMP/DoConcurrentConversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,9 @@ class DoConcurrentConversion

// For `local` (and `local_init`) opernads, emit corresponding `private`
// clauses and attach these clauses to the workshare loop.
if (!loop.getLocalOperands().empty())
if (!loop.getLocalVars().empty())
for (auto [op, sym, arg] : llvm::zip_equal(
loop.getLocalOperands(),
loop.getLocalVars(),
loop.getLocalSymsAttr().getAsRange<mlir::SymbolRefAttr>(),
loop.getRegionLocalArgs())) {
auto localizer = mlir::SymbolTable::lookupNearestSymbolFrom<
Expand Down
Loading