[flang-commits] [flang] [flang][MLIR][OpenMP] Extend delayed privatization for `CHARACTER` (PR #85369)

via flang-commits flang-commits at lists.llvm.org
Fri Mar 15 00:47:10 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 c3a1eb6207d85cb37ea29306481b40c9f6402309 7c1dc0251ae7592e0255b7a4160713d0bd30c771 -- flang/lib/Lower/Bridge.cpp flang/lib/Lower/OpenMP/DataSharingProcessor.cpp flang/lib/Lower/OpenMP/OpenMP.cpp flang/lib/Optimizer/Builder/HLFIRTools.cpp
``````````

</details>

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

``````````diff
diff --git a/flang/lib/Lower/Bridge.cpp b/flang/lib/Lower/Bridge.cpp
index 6d3ec72476..24698250cb 100644
--- a/flang/lib/Lower/Bridge.cpp
+++ b/flang/lib/Lower/Bridge.cpp
@@ -1066,11 +1066,11 @@ private:
   void copyVarHLFIR(mlir::Location loc, Fortran::lower::SymbolBox dst,
                     Fortran::lower::SymbolBox src) {
     assert(lowerToHighLevelFIR());
-    //llvm::errs() << ">>>> dst box: " << dst << "\n";
-    //llvm::errs() << ">>>> dst addr: " << dst.getAddr()
-    //             << ", type: " << dst.getAddr().getType() << "\n";
+    // llvm::errs() << ">>>> dst box: " << dst << "\n";
+    // llvm::errs() << ">>>> dst addr: " << dst.getAddr()
+    //              << ", type: " << dst.getAddr().getType() << "\n";
     hlfir::Entity lhs{dst.getAddr()};
-    //llvm::errs() << ">>>> src addr: " << src.getAddr() << "\n";
+    // llvm::errs() << ">>>> src addr: " << src.getAddr() << "\n";
     hlfir::Entity rhs{src.getAddr()};
     // Temporary_lhs is set to true in hlfir.assign below to avoid user
     // assignment to be used and finalization to be called on the LHS.
diff --git a/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp b/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp
index a2a56bf718..51498ccf6f 100644
--- a/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp
+++ b/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp
@@ -352,8 +352,7 @@ void DataSharingProcessor::doPrivatize(const Fortran::semantics::Symbol *sym) {
 
   Fortran::lower::SymbolBox hsb = converter.lookupOneLevelUpSymbol(*sym);
   assert(hsb && "Host symbol box not found");
-  //llvm::errs() << ">>>> hsb: " << hsb << "\n";
-
+  // llvm::errs() << ">>>> hsb: " << hsb << "\n";
 
   mlir::Type symType = hsb.getAddr().getType();
   mlir::Location symLoc = hsb.getAddr().getLoc();
@@ -381,7 +380,7 @@ void DataSharingProcessor::doPrivatize(const Fortran::semantics::Symbol *sym) {
         isFirstPrivate ? mlir::omp::DataSharingClauseType::FirstPrivate
                        : mlir::omp::DataSharingClauseType::Private);
     fir::ExtendedValue symExV = converter.getSymbolExtendedValue(*sym);
-    //llvm::errs() << ">>>> symExV: " << symExV << "\n";
+    // llvm::errs() << ">>>> symExV: " << symExV << "\n";
 
     symTable->pushScope();
 
@@ -459,14 +458,12 @@ void DataSharingProcessor::doPrivatize(const Fortran::semantics::Symbol *sym) {
           &copyRegion, /*insertPt=*/{}, {symType, symType}, {symLoc, symLoc});
       firOpBuilder.setInsertionPointToEnd(copyEntryBlock);
 
-
-
       addSymbol(copyRegion, 0, true);
-      //symTable->addSymbol(*sym, xxx(0),
-      //                    [>force=<]true);
+      // symTable->addSymbol(*sym, xxx(0),
+      //                     [>force=<]true);
       symTable->pushScope();
       addSymbol(copyRegion, 1);
-      //symTable->addSymbol(*sym, xxx(1));
+      // symTable->addSymbol(*sym, xxx(1));
       auto ip = firOpBuilder.saveInsertionPoint();
       copyFirstPrivateSymbol(sym, &ip);
 
diff --git a/flang/lib/Lower/OpenMP/OpenMP.cpp b/flang/lib/Lower/OpenMP/OpenMP.cpp
index 9f07eb9228..218eaca7d2 100644
--- a/flang/lib/Lower/OpenMP/OpenMP.cpp
+++ b/flang/lib/Lower/OpenMP/OpenMP.cpp
@@ -656,8 +656,8 @@ genParallelOp(Fortran::lower::AbstractConverter &converter,
                     [](mlir::Value v) { return v.getLoc(); });
 
     fir::FirOpBuilder &builder = converter.getFirOpBuilder();
-    builder.createBlock(&region, /*insertPt=*/{},
-                                            privateVarTypes, privateVarLocs);
+    builder.createBlock(&region, /*insertPt=*/{}, privateVarTypes,
+                        privateVarLocs);
 
     llvm::SmallVector<const Fortran::semantics::Symbol *> allSymbols =
         reductionSymbols;
diff --git a/flang/lib/Optimizer/Builder/HLFIRTools.cpp b/flang/lib/Optimizer/Builder/HLFIRTools.cpp
index 760c0e18b8..94a61279c5 100644
--- a/flang/lib/Optimizer/Builder/HLFIRTools.cpp
+++ b/flang/lib/Optimizer/Builder/HLFIRTools.cpp
@@ -850,7 +850,7 @@ static fir::ExtendedValue
 translateVariableToExtendedValue(mlir::Location loc, fir::FirOpBuilder &builder,
                                  hlfir::Entity variable,
                                  bool forceHlfirBase = false) {
-  //llvm::errs() << ">>>> translateVariableToExtendedValue\n";
+  // llvm::errs() << ">>>> translateVariableToExtendedValue\n";
   assert(variable.isVariable() && "must be a variable");
   /// When going towards FIR, use the original base value to avoid
   /// introducing descriptors at runtime when they are not required.
@@ -859,10 +859,10 @@ translateVariableToExtendedValue(mlir::Location loc, fir::FirOpBuilder &builder,
   if (variable.isMutableBox())
     return fir::MutableBoxValue(base, getExplicitTypeParams(variable),
                                 fir::MutableProperties{});
-  //llvm::errs() << "1>>>>\n";
+  // llvm::errs() << "1>>>>\n";
 
   if (base.getType().isa<fir::BaseBoxType>()) {
-  //llvm::errs() << "2>>>>\n";
+    // llvm::errs() << "2>>>>\n";
     if (!variable.isSimplyContiguous() || variable.isPolymorphic() ||
         variable.isDerivedWithLengthParameters() || variable.isOptional()) {
       llvm::SmallVector<mlir::Value> nonDefaultLbounds =
@@ -872,49 +872,49 @@ translateVariableToExtendedValue(mlir::Location loc, fir::FirOpBuilder &builder,
     }
     // Otherwise, the variable can be represented in a fir::ExtendedValue
     // without the overhead of a fir.box.
-  //llvm::errs() << "3>>>>\n";
+    // llvm::errs() << "3>>>>\n";
     base = genVariableRawAddress(loc, builder, variable);
   }
 
-  //llvm::errs() << "4>>>> base:" << base
-  //                 << ", with type: " << base.getType() << "\n";
+  // llvm::errs() << "4>>>> base:" << base
+  //                  << ", with type: " << base.getType() << "\n";
   if (variable.isScalar()) {
     if (variable.isCharacter()) {
-  //llvm::errs() << "5>>>>\n";
+      // llvm::errs() << "5>>>>\n";
       if (base.getType().isa<fir::BoxCharType>())
         return genUnboxChar(loc, builder, base);
-      //llvm::errs() << "5.5>>>> base:" << base
-      //             << ", with type: " << base.getType() << "\n";
+      // llvm::errs() << "5.5>>>> base:" << base
+      //              << ", with type: " << base.getType() << "\n";
       mlir::Value len = genCharacterVariableLength(loc, builder, variable);
       return fir::CharBoxValue{base, len};
     }
-  //llvm::errs() << "6>>>>\n";
+    // llvm::errs() << "6>>>>\n";
     return base;
   }
   llvm::SmallVector<mlir::Value> extents;
   llvm::SmallVector<mlir::Value> nonDefaultLbounds;
-  //llvm::errs() << "7>>>>\n";
+  // llvm::errs() << "7>>>>\n";
   if (variable.getType().isa<fir::BaseBoxType>() &&
       !variable.getIfVariableInterface()) {
-  //llvm::errs() << "8>>>>\n";
-    // This special case avoids generating two sets of identical
-    // fir.box_dim to get both the lower bounds and extents.
+    // llvm::errs() << "8>>>>\n";
+    //  This special case avoids generating two sets of identical
+    //  fir.box_dim to get both the lower bounds and extents.
     genLboundsAndExtentsFromBox(loc, builder, variable, nonDefaultLbounds,
                                 &extents);
   } else {
-  //llvm::errs() << "9>>>>\n";
+    // llvm::errs() << "9>>>>\n";
     extents = getVariableExtents(loc, builder, variable);
     nonDefaultLbounds = getNonDefaultLowerBounds(loc, builder, variable);
   }
-  //llvm::errs() << "10>>>>\n";
+  // llvm::errs() << "10>>>>\n";
   if (variable.isCharacter()) {
-    //llvm::errs() << ">>>> creating char box value: " << base
-    //             << ", with type: " << base.getType() << "\n";
+    // llvm::errs() << ">>>> creating char box value: " << base
+    //              << ", with type: " << base.getType() << "\n";
     return fir::CharArrayBoxValue{
         base, genCharacterVariableLength(loc, builder, variable), extents,
         nonDefaultLbounds};
   }
-  //llvm::errs() << "11>>>>\n";
+  // llvm::errs() << "11>>>>\n";
   return fir::ArrayBoxValue{base, extents, nonDefaultLbounds};
 }
 

``````````

</details>


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


More information about the flang-commits mailing list