[Mlir-commits] [mlir] 01cfdf1 - [mlir-opt] Rename internally the variables backing --no-implicit-module to ExplicitModule (NFC)
Mehdi Amini
llvmlistbot at llvm.org
Sun Feb 26 06:49:51 PST 2023
Author: Mehdi Amini
Date: 2023-02-26T09:32:23-05:00
New Revision: 01cfdf1f8d44928397b28fe56b1b9ca4884ab258
URL: https://github.com/llvm/llvm-project/commit/01cfdf1f8d44928397b28fe56b1b9ca4884ab258
DIFF: https://github.com/llvm/llvm-project/commit/01cfdf1f8d44928397b28fe56b1b9ca4884ab258.diff
LOG: [mlir-opt] Rename internally the variables backing --no-implicit-module to ExplicitModule (NFC)
The flag name isn't the best: avoiding negative is in general more readable
and conveys the intent better.
Added:
Modified:
mlir/include/mlir/Tools/mlir-opt/MlirOptMain.h
mlir/lib/Tools/mlir-opt/MlirOptMain.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/Tools/mlir-opt/MlirOptMain.h b/mlir/include/mlir/Tools/mlir-opt/MlirOptMain.h
index 70cb2957e7182..caa76934d1625 100644
--- a/mlir/include/mlir/Tools/mlir-opt/MlirOptMain.h
+++ b/mlir/include/mlir/Tools/mlir-opt/MlirOptMain.h
@@ -103,11 +103,11 @@ class MlirOptMainConfig {
bool shouldSplitInputFile() const { return splitInputFileFlag; }
/// Disable implicit addition of a top-level module op during parsing.
- MlirOptMainConfig &useImplicitModule(bool useImplicitModule) {
- useImplicitModuleFlag = useImplicitModule;
+ MlirOptMainConfig &useExplicitModule(bool useExplicitModule) {
+ useExplicitModuleFlag = useExplicitModule;
return *this;
}
- bool shouldUseImplicitModule() const { return useImplicitModuleFlag; }
+ bool shouldUseExplicitModule() const { return useExplicitModuleFlag; }
/// Set whether to check that emitted diagnostics match `expected-*` lines on
/// the corresponding line. This is meant for implementing diagnostic tests.
@@ -149,8 +149,8 @@ class MlirOptMainConfig {
/// process each chunk independently.
bool splitInputFileFlag = false;
- /// Use an implicit top-level module op during parsing.
- bool useImplicitModuleFlag = true;
+ /// Use an explicit top-level module op during parsing.
+ bool useExplicitModuleFlag = false;
/// Set whether to check that emitted diagnostics match `expected-*` lines on
/// the corresponding line. This is meant for implementing diagnostic tests.
@@ -177,14 +177,15 @@ LogicalResult MlirOptMain(llvm::raw_ostream &outputStream,
/// Perform the core processing behind `mlir-opt`.
/// This API is deprecated, use the MlirOptMainConfig version above instead.
-LogicalResult
-MlirOptMain(llvm::raw_ostream &outputStream,
- std::unique_ptr<llvm::MemoryBuffer> buffer,
- const PassPipelineCLParser &passPipeline, DialectRegistry ®istry,
- bool splitInputFile, bool verifyDiagnostics, bool verifyPasses,
- bool allowUnregisteredDialects,
- bool preloadDialectsInContext = false, bool emitBytecode = false,
- bool implicitModule = false, bool dumpPassPipeline = false);
+LogicalResult MlirOptMain(llvm::raw_ostream &outputStream,
+ std::unique_ptr<llvm::MemoryBuffer> buffer,
+ const PassPipelineCLParser &passPipeline,
+ DialectRegistry ®istry, bool splitInputFile,
+ bool verifyDiagnostics, bool verifyPasses,
+ bool allowUnregisteredDialects,
+ bool preloadDialectsInContext = false,
+ bool emitBytecode = false, bool explicitModule = true,
+ bool dumpPassPipeline = false);
/// Perform the core processing behind `mlir-opt`.
/// This API is deprecated, use the MlirOptMainConfig version above instead.
@@ -193,7 +194,7 @@ LogicalResult MlirOptMain(
PassPipelineFn passManagerSetupFn, DialectRegistry ®istry,
bool splitInputFile, bool verifyDiagnostics, bool verifyPasses,
bool allowUnregisteredDialects, bool preloadDialectsInContext = false,
- bool emitBytecode = false, bool implicitModule = false);
+ bool emitBytecode = false, bool explicitModule = true);
/// Implementation for tools like `mlir-opt`.
/// - toolName is used for the header displayed by `--help`.
diff --git a/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp b/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp
index 75eefb19991ab..ee64f41299c43 100644
--- a/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp
+++ b/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp
@@ -91,7 +91,7 @@ performActions(raw_ostream &os,
// Parse the input file and reset the context threading state.
TimingScope parserTiming = timing.nest("Parser");
OwningOpRef<Operation *> op = parseSourceFileForTool(
- sourceMgr, parseConfig, config.shouldUseImplicitModule());
+ sourceMgr, parseConfig, !config.shouldUseExplicitModule());
context->enableMultithreading(wasThreadingEnabled);
if (!op)
return failure();
@@ -202,7 +202,7 @@ LogicalResult mlir::MlirOptMain(raw_ostream &outputStream,
bool verifyDiagnostics, bool verifyPasses,
bool allowUnregisteredDialects,
bool preloadDialectsInContext,
- bool emitBytecode, bool implicitModule) {
+ bool emitBytecode, bool explicitModule) {
return MlirOptMain(outputStream, std::move(buffer), registry,
MlirOptMainConfig{}
.splitInputFile(splitInputFile)
@@ -211,7 +211,7 @@ LogicalResult mlir::MlirOptMain(raw_ostream &outputStream,
.allowUnregisteredDialects(allowUnregisteredDialects)
.preloadDialectsInContext(preloadDialectsInContext)
.emitBytecode(emitBytecode)
- .useImplicitModule(implicitModule)
+ .useExplicitModule(explicitModule)
.setPassPipelineSetupFn(passManagerSetupFn));
}
@@ -220,7 +220,7 @@ LogicalResult mlir::MlirOptMain(
const PassPipelineCLParser &passPipeline, DialectRegistry ®istry,
bool splitInputFile, bool verifyDiagnostics, bool verifyPasses,
bool allowUnregisteredDialects, bool preloadDialectsInContext,
- bool emitBytecode, bool implicitModule, bool dumpPassPipeline) {
+ bool emitBytecode, bool explicitModule, bool dumpPassPipeline) {
return MlirOptMain(outputStream, std::move(buffer), registry,
MlirOptMainConfig{}
.splitInputFile(splitInputFile)
@@ -229,7 +229,7 @@ LogicalResult mlir::MlirOptMain(
.allowUnregisteredDialects(allowUnregisteredDialects)
.preloadDialectsInContext(preloadDialectsInContext)
.emitBytecode(emitBytecode)
- .useImplicitModule(implicitModule)
+ .useExplicitModule(explicitModule)
.dumpPassPipeline(dumpPassPipeline)
.setPassPipelineParser(passPipeline));
}
@@ -273,7 +273,7 @@ LogicalResult mlir::MlirOptMain(int argc, char **argv, llvm::StringRef toolName,
"emit-bytecode", cl::desc("Emit bytecode when generating output"),
cl::init(false));
- static cl::opt<bool> noImplicitModule{
+ static cl::opt<bool> explicitModule{
"no-implicit-module",
cl::desc(
"Disable implicit addition of a top-level module op during parsing"),
@@ -333,7 +333,7 @@ LogicalResult mlir::MlirOptMain(int argc, char **argv, llvm::StringRef toolName,
.allowUnregisteredDialects(allowUnregisteredDialects)
.preloadDialectsInContext(preloadDialectsInContext)
.emitBytecode(emitBytecode)
- .useImplicitModule(!noImplicitModule)
+ .useExplicitModule(explicitModule)
.dumpPassPipeline(dumpPassPipeline);
if (failed(MlirOptMain(output->os(), std::move(file), registry, config)))
More information about the Mlir-commits
mailing list