[flang-commits] [flang] 0c4a7a5 - [fir][NFC] Address post commit comments on D112845

Valentin Clement via flang-commits flang-commits at lists.llvm.org
Mon Nov 1 09:57:04 PDT 2021


Author: Valentin Clement
Date: 2021-11-01T17:56:55+01:00
New Revision: 0c4a7a52636ef0b76e0a81aca8dcbc36eb38c0b2

URL: https://github.com/llvm/llvm-project/commit/0c4a7a52636ef0b76e0a81aca8dcbc36eb38c0b2
DIFF: https://github.com/llvm/llvm-project/commit/0c4a7a52636ef0b76e0a81aca8dcbc36eb38c0b2.diff

LOG: [fir][NFC] Address post commit comments on D112845

Address some of the comments on D112845 after
it was committed.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D112918

Added: 
    

Modified: 
    flang/include/flang/Optimizer/CodeGen/CGPasses.td
    flang/lib/Optimizer/CodeGen/CodeGen.cpp

Removed: 
    


################################################################################
diff  --git a/flang/include/flang/Optimizer/CodeGen/CGPasses.td b/flang/include/flang/Optimizer/CodeGen/CGPasses.td
index 103783b7ae668..dd8921319d43b 100644
--- a/flang/include/flang/Optimizer/CodeGen/CGPasses.td
+++ b/flang/include/flang/Optimizer/CodeGen/CGPasses.td
@@ -23,10 +23,7 @@ def FIRToLLVMLowering : Pass<"fir-to-llvm-ir", "mlir::ModuleOp"> {
     will also convert ops in the standard and FIRCG dialects.
   }];
   let constructor = "::fir::createFIRToLLVMPass()";
-  let dependentDialects = [
-    "fir::FIROpsDialect", "fir::FIRCodeGenDialect", "mlir::BuiltinDialect",
-    "mlir::LLVM::LLVMDialect", "mlir::omp::OpenMPDialect"
-  ];
+  let dependentDialects = ["mlir::LLVM::LLVMDialect"];
 }
 
 def CodeGenRewrite : Pass<"cg-rewrite"> {

diff  --git a/flang/lib/Optimizer/CodeGen/CodeGen.cpp b/flang/lib/Optimizer/CodeGen/CodeGen.cpp
index 867d05a7914ba..c92948309dde6 100644
--- a/flang/lib/Optimizer/CodeGen/CodeGen.cpp
+++ b/flang/lib/Optimizer/CodeGen/CodeGen.cpp
@@ -44,9 +44,8 @@ class FIROpConversion : public mlir::ConvertOpToLLVMPattern<FromOp> {
     return *static_cast<fir::LLVMTypeConverter *>(this->getTypeConverter());
   }
 };
-} // namespace
 
-namespace {
+// Lower `fir.address_of` operation to `llvm.address_of` operation.
 struct AddrOfOpConversion : public FIROpConversion<fir::AddrOfOp> {
   using FIROpConversion::FIROpConversion;
 
@@ -60,6 +59,7 @@ struct AddrOfOpConversion : public FIROpConversion<fir::AddrOfOp> {
   }
 };
 
+/// Lower `fir.has_value` operation to `llvm.return` operation.
 struct HasValueOpConversion : public FIROpConversion<fir::HasValueOp> {
   using FIROpConversion::FIROpConversion;
 
@@ -71,6 +71,9 @@ struct HasValueOpConversion : public FIROpConversion<fir::HasValueOp> {
   }
 };
 
+/// Lower `fir.global` operation to `llvm.global` operation.
+/// `fir.insert_on_range` operations are replaced with constant dense attribute
+/// if they are applied on the full range.
 struct GlobalOpConversion : public FIROpConversion<fir::GlobalOp> {
   using FIROpConversion::FIROpConversion;
 
@@ -133,6 +136,8 @@ struct GlobalOpConversion : public FIROpConversion<fir::GlobalOp> {
     return true;
   }
 
+  // TODO: String comparaison should be avoided. Replace linkName with an
+  // enumeration.
   mlir::LLVM::Linkage convertLinkage(Optional<StringRef> optLinkage) const {
     if (optLinkage.hasValue()) {
       auto name = optLinkage.getValue();


        


More information about the flang-commits mailing list