[flang-commits] [flang] [flang][OpenMP] Convert repeatable clauses (except Map) in ClauseProc… (PR #81623)

via flang-commits flang-commits at lists.llvm.org
Thu Mar 14 16:25:39 PDT 2024


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 49b8a99a0f7abdb34a671dd99bb9aba593129bf9 0ff3331c72c587dfb541cce9693b17a9f2852f70 -- flang/include/flang/Evaluate/tools.h flang/lib/Lower/OpenMP/ClauseProcessor.cpp flang/lib/Lower/OpenMP/ClauseProcessor.h flang/lib/Lower/OpenMP/Clauses.cpp flang/lib/Lower/OpenMP/Clauses.h flang/lib/Lower/OpenMP/OpenMP.cpp flang/lib/Lower/OpenMP/ReductionProcessor.cpp flang/lib/Lower/OpenMP/ReductionProcessor.h flang/lib/Lower/OpenMP/Utils.cpp flang/lib/Lower/OpenMP/Utils.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/flang/include/flang/Evaluate/tools.h b/flang/include/flang/Evaluate/tools.h
index 463204c9ca..aba40025ca 100644
--- a/flang/include/flang/Evaluate/tools.h
+++ b/flang/include/flang/Evaluate/tools.h
@@ -448,8 +448,7 @@ struct ExtractSubstringHelper {
   }
 };
 
-template <typename A>
-std::optional<Substring> ExtractSubstring(const A &x) {
+template <typename A> std::optional<Substring> ExtractSubstring(const A &x) {
   return ExtractSubstringHelper::visit(x);
 }
 
diff --git a/flang/lib/Lower/OpenMP/OpenMP.cpp b/flang/lib/Lower/OpenMP/OpenMP.cpp
index 8706ea1aad..5d4db06dda 100644
--- a/flang/lib/Lower/OpenMP/OpenMP.cpp
+++ b/flang/lib/Lower/OpenMP/OpenMP.cpp
@@ -863,8 +863,7 @@ genDataOp(Fortran::lower::AbstractConverter &converter,
   llvm::SmallVector<const Fortran::semantics::Symbol *> useDeviceSymbols;
 
   ClauseProcessor cp(converter, semaCtx, clauseList);
-  cp.processIf(clause::If::DirectiveNameModifier::TargetData,
-               ifClauseOperand);
+  cp.processIf(clause::If::DirectiveNameModifier::TargetData, ifClauseOperand);
   cp.processDevice(stmtCtx, deviceOperand);
   cp.processUseDevicePtr(devicePtrOperands, useDeviceTypes, useDeviceLocs,
                          useDeviceSymbols);
@@ -2449,7 +2448,8 @@ void Fortran::lower::genOpenMPReduction(
                 continue;
             }
             for (mlir::OpOperand &reductionValUse : reductionVal.getUses()) {
-              if (auto loadOp = mlir::dyn_cast<fir::LoadOp>(reductionValUse.getOwner())) {
+              if (auto loadOp =
+                      mlir::dyn_cast<fir::LoadOp>(reductionValUse.getOwner())) {
                 mlir::Value loadVal = loadOp.getRes();
                 if (reductionType.isa<fir::LogicalType>()) {
                   mlir::Operation *reductionOp = findReductionChain(loadVal);
@@ -2468,8 +2468,7 @@ void Fortran::lower::genOpenMPReduction(
           }
         }
       } else if (const auto *reductionIntrinsic =
-                     std::get_if<clause::ProcedureDesignator>(
-                         &redOperator.u)) {
+                     std::get_if<clause::ProcedureDesignator>(&redOperator.u)) {
         if (!ReductionProcessor::supportedIntrinsicProcReduction(
                 *reductionIntrinsic))
           continue;
@@ -2482,7 +2481,8 @@ void Fortran::lower::genOpenMPReduction(
               reductionVal = declOp.getBase();
             for (const mlir::OpOperand &reductionValUse :
                  reductionVal.getUses()) {
-              if (auto loadOp = mlir::dyn_cast<fir::LoadOp>(reductionValUse.getOwner())) {
+              if (auto loadOp =
+                      mlir::dyn_cast<fir::LoadOp>(reductionValUse.getOwner())) {
                 mlir::Value loadVal = loadOp.getRes();
                 // Max is lowered as a compare -> select.
                 // Match the pattern here.
diff --git a/flang/lib/Lower/OpenMP/ReductionProcessor.cpp b/flang/lib/Lower/OpenMP/ReductionProcessor.cpp
index b845d7dd56..6dc467c4f6 100644
--- a/flang/lib/Lower/OpenMP/ReductionProcessor.cpp
+++ b/flang/lib/Lower/OpenMP/ReductionProcessor.cpp
@@ -97,8 +97,8 @@ std::string ReductionProcessor::getReductionName(llvm::StringRef name,
 }
 
 std::string ReductionProcessor::getReductionName(
-    omp::clause::DefinedOperator::IntrinsicOperator intrinsicOp,
-    mlir::Type ty, bool isByRef) {
+    omp::clause::DefinedOperator::IntrinsicOperator intrinsicOp, mlir::Type ty,
+    bool isByRef) {
   std::string reductionName;
 
   switch (intrinsicOp) {
diff --git a/flang/lib/Lower/OpenMP/ReductionProcessor.h b/flang/lib/Lower/OpenMP/ReductionProcessor.h
index 43642348ea..ef6339407c 100644
--- a/flang/lib/Lower/OpenMP/ReductionProcessor.h
+++ b/flang/lib/Lower/OpenMP/ReductionProcessor.h
@@ -79,9 +79,9 @@ public:
   static std::string getReductionName(llvm::StringRef name, mlir::Type ty,
                                       bool isByRef);
 
-  static std::string getReductionName(
-      omp::clause::DefinedOperator::IntrinsicOperator intrinsicOp,
-      mlir::Type ty, bool isByRef);
+  static std::string
+  getReductionName(omp::clause::DefinedOperator::IntrinsicOperator intrinsicOp,
+                   mlir::Type ty, bool isByRef);
 
   /// This function returns the identity value of the operator \p
   /// reductionOpName. For example:

``````````

</details>


https://github.com/llvm/llvm-project/pull/81623


More information about the flang-commits mailing list