[llvm-branch-commits] [flang] [flang][fir] Small clean-up in `fir_DoConcurrentLoopOp`'s defintion (PR #146028)
Kareem Ergawy via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Jun 27 00:01:33 PDT 2025
https://github.com/ergawy updated https://github.com/llvm/llvm-project/pull/146028
>From 5f665c949781fda9406e67c74c31217dba170a4c Mon Sep 17 00:00:00 2001
From: ergawy <kareem.ergawy at amd.com>
Date: Fri, 27 Jun 2025 00:05:42 -0500
Subject: [PATCH] [flang][fir] Small clean-up in `fir_DoConcurrentLoopOp`'s
defintion
Re-organizes the op definition a little bit and removes a method that
does not add much value to the API.
---
.../include/flang/Optimizer/Dialect/FIROps.td | 22 +++++++++----------
.../OpenMP/DoConcurrentConversion.cpp | 4 ++--
2 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/flang/include/flang/Optimizer/Dialect/FIROps.td b/flang/include/flang/Optimizer/Dialect/FIROps.td
index 75cf020ec96c8..f304f0cf30ac5 100644
--- a/flang/include/flang/Optimizer/Dialect/FIROps.td
+++ b/flang/include/flang/Optimizer/Dialect/FIROps.td
@@ -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());
@@ -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());
- }
}];
}
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 llvm-branch-commits
mailing list