[flang-commits] [flang] 9c8db44 - Remove deprecated `preloadDialectInContext` flag for MlirOptMain that has been deprecated for 2 years

Mehdi Amini via flang-commits flang-commits at lists.llvm.org
Mon Apr 24 14:37:47 PDT 2023


Author: Mehdi Amini
Date: 2023-04-24T14:37:31-07:00
New Revision: 9c8db444bc859294401f211a7c8f4704a4edeb88

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

LOG: Remove deprecated `preloadDialectInContext` flag for MlirOptMain that has been deprecated for 2 years

See https://discourse.llvm.org/t/psa-preloaddialectincontext-has-been-deprecated-for-1y-and-will-be-removed/68992

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

Added: 
    

Modified: 
    flang/tools/fir-opt/fir-opt.cpp
    mlir/include/mlir/Tools/mlir-opt/MlirOptMain.h
    mlir/lib/Tools/mlir-opt/MlirOptMain.cpp
    mlir/tools/mlir-opt/mlir-opt.cpp

Removed: 
    


################################################################################
diff  --git a/flang/tools/fir-opt/fir-opt.cpp b/flang/tools/fir-opt/fir-opt.cpp
index b605c9dc52af4..d4457c57a0411 100644
--- a/flang/tools/fir-opt/fir-opt.cpp
+++ b/flang/tools/fir-opt/fir-opt.cpp
@@ -35,5 +35,5 @@ int main(int argc, char **argv) {
   DialectRegistry registry;
   fir::support::registerDialects(registry);
   return failed(MlirOptMain(argc, argv, "FIR modular optimizer driver\n",
-      registry, /*preloadDialectsInContext=*/false));
+      registry));
 }

diff  --git a/mlir/include/mlir/Tools/mlir-opt/MlirOptMain.h b/mlir/include/mlir/Tools/mlir-opt/MlirOptMain.h
index ca6d78f407aa8..1581f6b62c23a 100644
--- a/mlir/include/mlir/Tools/mlir-opt/MlirOptMain.h
+++ b/mlir/include/mlir/Tools/mlir-opt/MlirOptMain.h
@@ -107,15 +107,6 @@ class MlirOptMainConfig {
     return success();
   }
 
-  // Deprecated.
-  MlirOptMainConfig &preloadDialectsInContext(bool preload) {
-    preloadDialectsInContextFlag = preload;
-    return *this;
-  }
-  bool shouldPreloadDialectsInContext() const {
-    return preloadDialectsInContextFlag;
-  }
-
   /// Show the registered dialects before trying to load the input file.
   MlirOptMainConfig &showDialects(bool show) {
     showDialectsFlag = show;
@@ -180,9 +171,6 @@ class MlirOptMainConfig {
   /// The callback to populate the pass manager.
   std::function<LogicalResult(PassManager &)> passPipelineCallback;
 
-  /// Deprecated.
-  bool preloadDialectsInContextFlag = false;
-
   /// Show the registered dialects before trying to load the input file.
   bool showDialectsFlag = false;
 
@@ -219,12 +207,8 @@ LogicalResult MlirOptMain(llvm::raw_ostream &outputStream,
 /// Implementation for tools like `mlir-opt`.
 /// - toolName is used for the header displayed by `--help`.
 /// - registry should contain all the dialects that can be parsed in the source.
-/// - preloadDialectsInContext will trigger the upfront loading of all
-///   dialects from the global registry in the MLIRContext. This option is
-///   deprecated and will be removed soon.
 LogicalResult MlirOptMain(int argc, char **argv, llvm::StringRef toolName,
-                          DialectRegistry &registry,
-                          bool preloadDialectsInContext = false);
+                          DialectRegistry &registry);
 
 /// Helper wrapper to return the result of MlirOptMain directly from main.
 ///

diff  --git a/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp b/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp
index 23a19635945dd..06039b9fa1ec1 100644
--- a/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp
+++ b/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp
@@ -300,8 +300,6 @@ static LogicalResult processBuffer(raw_ostream &os,
     return failure();
 
   // Parse the input file.
-  if (config.shouldPreloadDialectsInContext())
-    context.loadAllAvailableDialects();
   context.allowUnregisteredDialects(config.shouldAllowUnregisteredDialects());
   if (config.shouldVerifyDiagnostics())
     context.printOpOnDiagnostic(false);
@@ -363,8 +361,7 @@ LogicalResult mlir::MlirOptMain(llvm::raw_ostream &outputStream,
 }
 
 LogicalResult mlir::MlirOptMain(int argc, char **argv, llvm::StringRef toolName,
-                                DialectRegistry &registry,
-                                bool preloadDialectsInContext) {
+                                DialectRegistry &registry) {
   static cl::opt<std::string> inputFilename(
       cl::Positional, cl::desc("<input file>"), cl::init("-"));
 
@@ -392,7 +389,6 @@ LogicalResult mlir::MlirOptMain(int argc, char **argv, llvm::StringRef toolName,
   // Parse pass names in main to ensure static initialization completed.
   cl::ParseCommandLineOptions(argc, argv, helpHeader);
   MlirOptMainConfig config = MlirOptMainConfig::createFromCLOptions();
-  config.preloadDialectsInContext(preloadDialectsInContext);
 
   // When reading from stdin and the input is a tty, it is often a user mistake
   // and the process "appears to be stuck". Print a message to let the user know

diff  --git a/mlir/tools/mlir-opt/mlir-opt.cpp b/mlir/tools/mlir-opt/mlir-opt.cpp
index ce9008b58ba2b..13a525f0bcff8 100644
--- a/mlir/tools/mlir-opt/mlir-opt.cpp
+++ b/mlir/tools/mlir-opt/mlir-opt.cpp
@@ -261,6 +261,5 @@ int main(int argc, char **argv) {
   ::test::registerTestDynDialect(registry);
 #endif
   return mlir::asMainReturnCode(
-      mlir::MlirOptMain(argc, argv, "MLIR modular optimizer driver\n", registry,
-                        /*preloadDialectsInContext=*/false));
+      mlir::MlirOptMain(argc, argv, "MLIR modular optimizer driver\n", registry));
 }


        


More information about the flang-commits mailing list