Skip to content

Commit a510e75

Browse files
authored
[flang][fir] Small clean-up in fir_DoConcurrentLoopOp's defintion (#146028)
Re-organizes the op definition a little bit and removes a method that does not add much value to the API. PR stack: - #145837 - #146025 - #146028 (this one) - #146033
1 parent 17784e8 commit a510e75

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

flang/include/flang/Optimizer/Dialect/FIROps.td

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3878,9 +3878,17 @@ def fir_DoConcurrentLoopOp : fir_Op<"do_concurrent.loop",
38783878
let hasVerifier = 1;
38793879

38803880
let extraClassDeclaration = [{
3881-
unsigned getNumInductionVars() { return getLowerBound().size(); }
3881+
unsigned getNumInductionVars() {
3882+
return getLowerBound().size();
3883+
}
38823884

3883-
unsigned getNumLocalOperands() { return getLocalVars().size(); }
3885+
unsigned getNumLocalOperands() {
3886+
return getLocalVars().size();
3887+
}
3888+
3889+
unsigned getNumReduceOperands() {
3890+
return getReduceVars().size();
3891+
}
38843892

38853893
mlir::Block::BlockArgListType getInductionVars() {
38863894
return getBody()->getArguments().slice(0, getNumInductionVars());
@@ -3900,16 +3908,6 @@ def fir_DoConcurrentLoopOp : fir_Op<"do_concurrent.loop",
39003908
/// Number of operands controlling the loop
39013909
unsigned getNumControlOperands() { return getLowerBound().size() * 3; }
39023910

3903-
// Get Number of reduction operands
3904-
unsigned getNumReduceOperands() {
3905-
return getReduceVars().size();
3906-
}
3907-
3908-
mlir::Operation::operand_range getLocalOperands() {
3909-
return getOperands()
3910-
.slice(getNumControlOperands() + getNumReduceOperands(),
3911-
getNumLocalOperands());
3912-
}
39133911
}];
39143912
}
39153913

flang/lib/Optimizer/OpenMP/DoConcurrentConversion.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,9 @@ class DoConcurrentConversion
314314

315315
// For `local` (and `local_init`) opernads, emit corresponding `private`
316316
// clauses and attach these clauses to the workshare loop.
317-
if (!loop.getLocalOperands().empty())
317+
if (!loop.getLocalVars().empty())
318318
for (auto [op, sym, arg] : llvm::zip_equal(
319-
loop.getLocalOperands(),
319+
loop.getLocalVars(),
320320
loop.getLocalSymsAttr().getAsRange<mlir::SymbolRefAttr>(),
321321
loop.getRegionLocalArgs())) {
322322
auto localizer = mlir::SymbolTable::lookupNearestSymbolFrom<

0 commit comments

Comments
 (0)