[flang-commits] [flang] ccaaeca - [flang][NFC] Move current inliner files in Dialect directory

Valentin Clement via flang-commits flang-commits at lists.llvm.org
Thu Jan 20 04:34:49 PST 2022


Author: Valentin Clement
Date: 2022-01-20T13:34:44+01:00
New Revision: ccaaeca9106dc02e0295c33aa9e20d58d16ddf98

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

LOG: [flang][NFC] Move current inliner files in Dialect directory

This patch just move the files from the Transforms directory to
the Dialect directory.

Reviewed By: jeanPerier

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

Added: 
    flang/lib/Optimizer/Dialect/Inliner.cpp

Modified: 
    flang/include/flang/Optimizer/Dialect/FIRDialect.h
    flang/include/flang/Optimizer/Transforms/Passes.h
    flang/lib/Optimizer/Dialect/CMakeLists.txt
    flang/lib/Optimizer/Transforms/CMakeLists.txt

Removed: 
    flang/lib/Optimizer/Transforms/Inliner.cpp


################################################################################
diff  --git a/flang/include/flang/Optimizer/Dialect/FIRDialect.h b/flang/include/flang/Optimizer/Dialect/FIRDialect.h
index fb828716d45a1..5a69e3fa23a8f 100644
--- a/flang/include/flang/Optimizer/Dialect/FIRDialect.h
+++ b/flang/include/flang/Optimizer/Dialect/FIRDialect.h
@@ -15,6 +15,10 @@
 
 #include "mlir/IR/Dialect.h"
 
+namespace mlir {
+class BlockAndValueMapping;
+} // namespace mlir
+
 namespace fir {
 
 /// FIR dialect
@@ -50,6 +54,11 @@ class FIRCodeGenDialect final : public mlir::Dialect {
   static llvm::StringRef getDialectNamespace() { return "fircg"; }
 };
 
+/// Support for inlining on FIR.
+bool canLegallyInline(mlir::Operation *op, mlir::Region *reg, bool,
+                      mlir::BlockAndValueMapping &map);
+bool canLegallyInline(mlir::Operation *, mlir::Operation *, bool);
+
 } // namespace fir
 
 #endif // FORTRAN_OPTIMIZER_DIALECT_FIRDIALECT_H

diff  --git a/flang/include/flang/Optimizer/Transforms/Passes.h b/flang/include/flang/Optimizer/Transforms/Passes.h
index 4df56ca692f00..2e273163ebfc4 100644
--- a/flang/include/flang/Optimizer/Transforms/Passes.h
+++ b/flang/include/flang/Optimizer/Transforms/Passes.h
@@ -36,10 +36,6 @@ std::unique_ptr<mlir::Pass> createMemDataFlowOptPass();
 std::unique_ptr<mlir::Pass> createPromoteToAffinePass();
 std::unique_ptr<mlir::Pass> createMemoryAllocationPass();
 
-/// Support for inlining on FIR.
-bool canLegallyInline(mlir::Operation *op, mlir::Region *reg,
-                      mlir::BlockAndValueMapping &map);
-
 // declarative passes
 #define GEN_PASS_REGISTRATION
 #include "flang/Optimizer/Transforms/Passes.h.inc"

diff  --git a/flang/lib/Optimizer/Dialect/CMakeLists.txt b/flang/lib/Optimizer/Dialect/CMakeLists.txt
index 8b00c89daeb2a..def1ef82f683e 100644
--- a/flang/lib/Optimizer/Dialect/CMakeLists.txt
+++ b/flang/lib/Optimizer/Dialect/CMakeLists.txt
@@ -3,6 +3,7 @@ add_flang_library(FIRDialect
   FIRDialect.cpp
   FIROps.cpp
   FIRType.cpp
+  Inliner.cpp
 
   DEPENDS
   CanonicalizationPatternsIncGen

diff  --git a/flang/lib/Optimizer/Transforms/Inliner.cpp b/flang/lib/Optimizer/Dialect/Inliner.cpp
similarity index 74%
rename from flang/lib/Optimizer/Transforms/Inliner.cpp
rename to flang/lib/Optimizer/Dialect/Inliner.cpp
index 716665a5c240c..ffd7e3e075618 100644
--- a/flang/lib/Optimizer/Transforms/Inliner.cpp
+++ b/flang/lib/Optimizer/Dialect/Inliner.cpp
@@ -7,9 +7,6 @@
 //===----------------------------------------------------------------------===//
 
 #include "flang/Optimizer/Dialect/FIRDialect.h"
-#include "flang/Optimizer/Dialect/FIROps.h"
-#include "flang/Optimizer/Transforms/Passes.h"
-#include "mlir/Transforms/Passes.h"
 #include "llvm/Support/CommandLine.h"
 
 static llvm::cl::opt<bool>
@@ -18,7 +15,11 @@ static llvm::cl::opt<bool>
                        llvm::cl::init(false));
 
 /// Should we inline the callable `op` into region `reg`?
-bool fir::canLegallyInline(mlir::Operation *op, mlir::Region *reg,
-                           mlir::BlockAndValueMapping &map) {
+bool fir::canLegallyInline(mlir::Operation *, mlir::Region *, bool,
+                           mlir::BlockAndValueMapping &) {
+  return aggressivelyInline;
+}
+
+bool fir::canLegallyInline(mlir::Operation *, mlir::Operation *, bool) {
   return aggressivelyInline;
 }

diff  --git a/flang/lib/Optimizer/Transforms/CMakeLists.txt b/flang/lib/Optimizer/Transforms/CMakeLists.txt
index 767145e171aeb..3fb8d0fa8108b 100644
--- a/flang/lib/Optimizer/Transforms/CMakeLists.txt
+++ b/flang/lib/Optimizer/Transforms/CMakeLists.txt
@@ -4,7 +4,6 @@ add_flang_library(FIRTransforms
   AffineDemotion.cpp
   CharacterConversion.cpp
   ArrayValueCopy.cpp
-  Inliner.cpp
   ExternalNameConversion.cpp
   MemoryAllocation.cpp
   MemRefDataFlowOpt.cpp


        


More information about the flang-commits mailing list