[flang-commits] [flang] [flang][OpenMP] Support user-defined declare reduction with derived types (PR #184897)
via flang-commits
flang-commits at lists.llvm.org
Thu Mar 5 14:01:20 PST 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- flang/lib/Lower/OpenMP/OpenMP.cpp flang/lib/Lower/Support/ReductionProcessor.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/flang/lib/Lower/OpenMP/OpenMP.cpp b/flang/lib/Lower/OpenMP/OpenMP.cpp
index c12787057..eeadc7329 100644
--- a/flang/lib/Lower/OpenMP/OpenMP.cpp
+++ b/flang/lib/Lower/OpenMP/OpenMP.cpp
@@ -4007,9 +4007,10 @@ static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
// raw symbol name to match the sym->name().ToString() lookup path.
fir::FirOpBuilder &builder = converter.getFirOpBuilder();
const auto &kindMap = builder.getKindMap();
- mlir::Type redType = isByRef
- ? static_cast<mlir::Type>(fir::ReferenceType::get(reductionType))
- : reductionType;
+ mlir::Type redType =
+ isByRef
+ ? static_cast<mlir::Type>(fir::ReferenceType::get(reductionType))
+ : reductionType;
std::string reductionNameStr = Fortran::common::visit(
common::visitors{
@@ -4040,9 +4041,9 @@ static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
identifier.u);
ReductionProcessor::createDeclareReductionHelper<
- mlir::omp::DeclareReductionOp>(
- converter, reductionNameStr, redType,
- converter.getCurrentLocation(), isByRef, genCombinerCB, genInitValueCB);
+ mlir::omp::DeclareReductionOp>(converter, reductionNameStr, redType,
+ converter.getCurrentLocation(), isByRef,
+ genCombinerCB, genInitValueCB);
}
}
diff --git a/flang/lib/Lower/Support/ReductionProcessor.cpp b/flang/lib/Lower/Support/ReductionProcessor.cpp
index 1a6f372a1..eaaf643ec 100644
--- a/flang/lib/Lower/Support/ReductionProcessor.cpp
+++ b/flang/lib/Lower/Support/ReductionProcessor.cpp
@@ -802,8 +802,7 @@ bool ReductionProcessor::processReductionArguments(
// operator+type, reuse it instead of generating a new one
// (which would fail for non-predefined types like derived types).
mlir::ModuleOp module = builder.getModule();
- if (auto existingDecl =
- module.lookupSymbol<OpType>(reductionName)) {
+ if (auto existingDecl = module.lookupSymbol<OpType>(reductionName)) {
reductionDeclSymbols.push_back(mlir::SymbolRefAttr::get(
builder.getContext(), existingDecl.getSymName()));
++idx;
``````````
</details>
https://github.com/llvm/llvm-project/pull/184897
More information about the flang-commits
mailing list