[flang-commits] [flang] a510e75 - [flang][fir] Small clean-up in `fir_DoConcurrentLoopOp`'s defintion (#146028)
via flang-commits
flang-commits at lists.llvm.org
Thu Jul 10 23:30:40 PDT 2025
Author: Kareem Ergawy
Date: 2025-07-11T08:30:36+02:00
New Revision: a510e75949a4efa4305ba4c6276c9098693d465e
URL: https://github.com/llvm/llvm-project/commit/a510e75949a4efa4305ba4c6276c9098693d465e
DIFF: https://github.com/llvm/llvm-project/commit/a510e75949a4efa4305ba4c6276c9098693d465e.diff
LOG: [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:
- https://github.com/llvm/llvm-project/pull/145837
- https://github.com/llvm/llvm-project/pull/146025
- https://github.com/llvm/llvm-project/pull/146028 (this one)
- https://github.com/llvm/llvm-project/pull/146033
Added:
Modified:
flang/include/flang/Optimizer/Dialect/FIROps.td
flang/lib/Optimizer/OpenMP/DoConcurrentConversion.cpp
Removed:
################################################################################
diff --git a/flang/include/flang/Optimizer/Dialect/FIROps.td b/flang/include/flang/Optimizer/Dialect/FIROps.td
index c3d3582a50e7f..e3f5c4403002a 100644
--- a/flang/include/flang/Optimizer/Dialect/FIROps.td
+++ b/flang/include/flang/Optimizer/Dialect/FIROps.td
@@ -3878,9 +3878,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());
@@ -3900,16 +3908,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());
- }
}];
}
diff --git a/flang/lib/Optimizer/OpenMP/DoConcurrentConversion.cpp b/flang/lib/Optimizer/OpenMP/DoConcurrentConversion.cpp
index 28f6c8bf02813..709cf1d0938fa 100644
--- a/flang/lib/Optimizer/OpenMP/DoConcurrentConversion.cpp
+++ b/flang/lib/Optimizer/OpenMP/DoConcurrentConversion.cpp
@@ -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<
More information about the flang-commits
mailing list