diff --git a/mlir/examples/toy/Ch2/toyc.cpp b/mlir/examples/toy/Ch2/toyc.cpp --- a/mlir/examples/toy/Ch2/toyc.cpp +++ b/mlir/examples/toy/Ch2/toyc.cpp @@ -68,7 +68,7 @@ } int dumpMLIR() { - mlir::MLIRContext context(/*loadAllDialects=*/false); + mlir::MLIRContext context; // Load our Dialect in this MLIR Context. context.getOrLoadDialect(); diff --git a/mlir/examples/toy/Ch3/toyc.cpp b/mlir/examples/toy/Ch3/toyc.cpp --- a/mlir/examples/toy/Ch3/toyc.cpp +++ b/mlir/examples/toy/Ch3/toyc.cpp @@ -102,7 +102,7 @@ } int dumpMLIR() { - mlir::MLIRContext context(/*loadAllDialects=*/false); + mlir::MLIRContext context; // Load our Dialect in this MLIR Context. context.getOrLoadDialect(); diff --git a/mlir/examples/toy/Ch4/toyc.cpp b/mlir/examples/toy/Ch4/toyc.cpp --- a/mlir/examples/toy/Ch4/toyc.cpp +++ b/mlir/examples/toy/Ch4/toyc.cpp @@ -103,7 +103,7 @@ } int dumpMLIR() { - mlir::MLIRContext context(/*loadAllDialects=*/false); + mlir::MLIRContext context; // Load our Dialect in this MLIR Context. context.getOrLoadDialect(); diff --git a/mlir/examples/toy/Ch5/toyc.cpp b/mlir/examples/toy/Ch5/toyc.cpp --- a/mlir/examples/toy/Ch5/toyc.cpp +++ b/mlir/examples/toy/Ch5/toyc.cpp @@ -106,7 +106,7 @@ } int dumpMLIR() { - mlir::MLIRContext context(/*loadAllDialects=*/false); + mlir::MLIRContext context; // Load our Dialect in this MLIR Context. context.getOrLoadDialect(); @@ -172,8 +172,6 @@ } int main(int argc, char **argv) { - mlir::registerAllDialects(); - // Register any command line options. mlir::registerAsmPrinterCLOptions(); mlir::registerMLIRContextCLOptions(); diff --git a/mlir/examples/toy/Ch6/toyc.cpp b/mlir/examples/toy/Ch6/toyc.cpp --- a/mlir/examples/toy/Ch6/toyc.cpp +++ b/mlir/examples/toy/Ch6/toyc.cpp @@ -241,8 +241,6 @@ } int main(int argc, char **argv) { - mlir::registerAllDialects(); - // Register any command line options. mlir::registerAsmPrinterCLOptions(); mlir::registerMLIRContextCLOptions(); @@ -255,7 +253,7 @@ // If we aren't dumping the AST, then we are compiling with/to MLIR. - mlir::MLIRContext context(/*loadAllDialects=*/false); + mlir::MLIRContext context; // Load our Dialect in this MLIR Context. context.getOrLoadDialect(); diff --git a/mlir/examples/toy/Ch7/toyc.cpp b/mlir/examples/toy/Ch7/toyc.cpp --- a/mlir/examples/toy/Ch7/toyc.cpp +++ b/mlir/examples/toy/Ch7/toyc.cpp @@ -242,8 +242,6 @@ } int main(int argc, char **argv) { - mlir::registerAllDialects(); - // Register any command line options. mlir::registerAsmPrinterCLOptions(); mlir::registerMLIRContextCLOptions(); @@ -256,7 +254,7 @@ // If we aren't dumping the AST, then we are compiling with/to MLIR. - mlir::MLIRContext context(/*loadAllDialects=*/false); + mlir::MLIRContext context; // Load our Dialect in this MLIR Context. context.getOrLoadDialect(); diff --git a/mlir/include/mlir/IR/Dialect.h b/mlir/include/mlir/IR/Dialect.h --- a/mlir/include/mlir/IR/Dialect.h +++ b/mlir/include/mlir/IR/Dialect.h @@ -283,41 +283,6 @@ MapTy registry; }; -/// Deprecated: this provides a global registry for convenience, while we're -/// transitionning the registration mechanism to a stateless approach. -DialectRegistry &getGlobalDialectRegistry(); - -/// Registers all dialects from the global registries with the -/// specified MLIRContext. This won't load the dialects in the context, -/// but only make them available for lazy loading by name. -/// Note: This method is not thread-safe. -void registerAllDialects(MLIRContext *context); - -/// Register and return the dialect with the given namespace in the provided -/// context. Returns nullptr is there is no constructor registered for this -/// dialect. -inline Dialect *registerDialect(StringRef name, MLIRContext *context) { - return getGlobalDialectRegistry().loadByName(name, context); -} - -/// Utility to register a dialect. Client can register their dialect with the -/// global registry by calling registerDialect(); -/// Note: This method is not thread-safe. -template void registerDialect() { - getGlobalDialectRegistry().insert(); -} - -/// DialectRegistration provides a global initializer that registers a Dialect -/// allocation routine. -/// -/// Usage: -/// -/// // At namespace scope. -/// static DialectRegistration Unused; -template struct DialectRegistration { - DialectRegistration() { registerDialect(); } -}; - } // namespace mlir namespace llvm { diff --git a/mlir/include/mlir/IR/MLIRContext.h b/mlir/include/mlir/IR/MLIRContext.h --- a/mlir/include/mlir/IR/MLIRContext.h +++ b/mlir/include/mlir/IR/MLIRContext.h @@ -24,7 +24,6 @@ class Location; class MLIRContextImpl; class StorageUniquer; -DialectRegistry &getGlobalDialectRegistry(); /// MLIRContext is the top-level object for a collection of MLIR modules. It /// holds immortal uniqued objects like types, and the tables used to unique @@ -40,7 +39,7 @@ /// The loadAllDialects parameters allows to load all dialects from the global /// registry on Context construction. It is deprecated and will be removed /// soon. - explicit MLIRContext(bool loadAllDialects = true); + explicit MLIRContext(); ~MLIRContext(); /// Return information about all IR dialects loaded in the context. @@ -88,11 +87,6 @@ loadDialect(); } - /// Deprecated: load all globally registered dialects into this context. - /// This method will be removed soon, it can be used temporarily as we're - /// phasing out the global registry. - void loadAllGloballyRegisteredDialects(); - /// Get (or create) a dialect for the given derived dialect name. /// The dialect will be loaded from the registry if no dialect is found. /// If no dialect is loaded for this name and none is available in the diff --git a/mlir/include/mlir/InitAllDialects.h b/mlir/include/mlir/InitAllDialects.h --- a/mlir/include/mlir/InitAllDialects.h +++ b/mlir/include/mlir/InitAllDialects.h @@ -58,13 +58,6 @@ // clang-format on } -// This function should be called before creating any MLIRContext if one expect -// all the possible dialects to be made available to the context automatically. -inline void registerAllDialects() { - static bool initOnce = - ([]() { registerAllDialects(getGlobalDialectRegistry()); }(), true); - (void)initOnce; -} } // namespace mlir #endif // MLIR_INITALLDIALECTS_H_ diff --git a/mlir/lib/CAPI/IR/IR.cpp b/mlir/lib/CAPI/IR/IR.cpp --- a/mlir/lib/CAPI/IR/IR.cpp +++ b/mlir/lib/CAPI/IR/IR.cpp @@ -51,7 +51,7 @@ /* ========================================================================== */ MlirContext mlirContextCreate() { - auto *context = new MLIRContext(/*loadAllDialects=*/false); + auto *context = new MLIRContext; return wrap(context); } diff --git a/mlir/lib/Dialect/SPIRV/Serialization/TranslateRegistration.cpp b/mlir/lib/Dialect/SPIRV/Serialization/TranslateRegistration.cpp --- a/mlir/lib/Dialect/SPIRV/Serialization/TranslateRegistration.cpp +++ b/mlir/lib/Dialect/SPIRV/Serialization/TranslateRegistration.cpp @@ -11,6 +11,7 @@ // //===----------------------------------------------------------------------===// +#include "mlir/Dialect/SPIRV/SPIRVDialect.h" #include "mlir/Dialect/SPIRV/SPIRVModule.h" #include "mlir/Dialect/SPIRV/SPIRVOps.h" #include "mlir/Dialect/SPIRV/Serialization.h" @@ -118,6 +119,7 @@ static LogicalResult roundTripModule(llvm::SourceMgr &sourceMgr, bool emitDebugInfo, raw_ostream &output, MLIRContext *context) { + context->loadDialect(); // Parse an MLIR module from the source manager. auto srcModule = OwningModuleRef(parseSourceFile(sourceMgr, context)); if (!srcModule) diff --git a/mlir/lib/ExecutionEngine/JitRunner.cpp b/mlir/lib/ExecutionEngine/JitRunner.cpp --- a/mlir/lib/ExecutionEngine/JitRunner.cpp +++ b/mlir/lib/ExecutionEngine/JitRunner.cpp @@ -19,6 +19,7 @@ #include "mlir/Dialect/LLVMIR/LLVMDialect.h" #include "mlir/ExecutionEngine/ExecutionEngine.h" #include "mlir/ExecutionEngine/OptUtils.h" +#include "mlir/InitAllDialects.h" #include "mlir/IR/MLIRContext.h" #include "mlir/IR/Module.h" #include "mlir/IR/StandardTypes.h" @@ -259,8 +260,8 @@ } } - MLIRContext context(/*loadAllDialects=*/false); - registerAllDialects(&context); + MLIRContext context; + registerAllDialects(context.getDialectRegistry()); auto m = parseMLIRInput(options.inputFilename, &context); if (!m) { diff --git a/mlir/lib/IR/Dialect.cpp b/mlir/lib/IR/Dialect.cpp --- a/mlir/lib/IR/Dialect.cpp +++ b/mlir/lib/IR/Dialect.cpp @@ -26,14 +26,6 @@ // Dialect Registration //===----------------------------------------------------------------------===// -/// Registry for all dialect allocation functions. -static llvm::ManagedStatic dialectRegistry; -DialectRegistry &mlir::getGlobalDialectRegistry() { return *dialectRegistry; } - -void mlir::registerAllDialects(MLIRContext *context) { - dialectRegistry->appendTo(context->getDialectRegistry()); -} - Dialect *DialectRegistry::loadByName(StringRef name, MLIRContext *context) { auto it = registry.find(name.str()); if (it == registry.end()) diff --git a/mlir/lib/IR/MLIRContext.cpp b/mlir/lib/IR/MLIRContext.cpp --- a/mlir/lib/IR/MLIRContext.cpp +++ b/mlir/lib/IR/MLIRContext.cpp @@ -349,7 +349,7 @@ }; } // end namespace mlir -MLIRContext::MLIRContext(bool loadAllDialects) : impl(new MLIRContextImpl()) { +MLIRContext::MLIRContext() : impl(new MLIRContextImpl()) { // Initialize values based on the command line flags if they were provided. if (clOptions.isConstructed()) { disableMultithreading(clOptions->disableThreading); @@ -357,10 +357,8 @@ printStackTraceOnDiagnostic(clOptions->printStackTraceOnDiagnostic); } - // Register dialects with this context. + // Ensure the builtin dialect is always pre-loaded. getOrLoadDialect(); - if (loadAllDialects) - loadAllGloballyRegisteredDialects(); // Initialize several common attributes and types to avoid the need to lock // the context when accessing them. @@ -500,10 +498,6 @@ return dialect.get(); } -void MLIRContext::loadAllGloballyRegisteredDialects() { - getGlobalDialectRegistry().loadAll(this); -} - bool MLIRContext::allowsUnregisteredDialects() { return impl->allowUnregisteredDialects; } diff --git a/mlir/lib/Support/MlirOptMain.cpp b/mlir/lib/Support/MlirOptMain.cpp --- a/mlir/lib/Support/MlirOptMain.cpp +++ b/mlir/lib/Support/MlirOptMain.cpp @@ -89,7 +89,7 @@ sourceMgr.AddNewSourceBuffer(std::move(ownedBuffer), SMLoc()); // Parse the input file. - MLIRContext context(/*loadAllDialects=*/preloadDialectsInContext); + MLIRContext context; registry.appendTo(context.getDialectRegistry()); if (preloadDialectsInContext) registry.loadAll(&context); diff --git a/mlir/test/EDSC/builder-api-test.cpp b/mlir/test/EDSC/builder-api-test.cpp --- a/mlir/test/EDSC/builder-api-test.cpp +++ b/mlir/test/EDSC/builder-api-test.cpp @@ -36,7 +36,7 @@ using namespace mlir::edsc::intrinsics; static MLIRContext &globalContext() { - static thread_local MLIRContext context(/*loadAllDialects=*/false); + static thread_local MLIRContext context; static thread_local bool initOnce = [&]() { // clang-format off context.loadDialect(), true); (void)once; diff --git a/mlir/test/lib/Dialect/Test/TestDialect.cpp b/mlir/test/lib/Dialect/Test/TestDialect.cpp --- a/mlir/test/lib/Dialect/Test/TestDialect.cpp +++ b/mlir/test/lib/Dialect/Test/TestDialect.cpp @@ -693,9 +693,6 @@ // Dialect Registration //===----------------------------------------------------------------------===// -// Static initialization for Test dialect registration. -static DialectRegistration testDialect; - #include "TestOpEnums.cpp.inc" #include "TestOpStructs.cpp.inc" #include "TestTypeInterfaces.cpp.inc" diff --git a/mlir/tools/mlir-cpu-runner/mlir-cpu-runner.cpp b/mlir/tools/mlir-cpu-runner/mlir-cpu-runner.cpp --- a/mlir/tools/mlir-cpu-runner/mlir-cpu-runner.cpp +++ b/mlir/tools/mlir-cpu-runner/mlir-cpu-runner.cpp @@ -19,7 +19,6 @@ #include "llvm/Support/TargetSelect.h" int main(int argc, char **argv) { - mlir::registerAllDialects(); llvm::InitLLVM y(argc, argv); llvm::InitializeNativeTarget(); llvm::InitializeNativeTargetAsmPrinter(); diff --git a/mlir/tools/mlir-cuda-runner/mlir-cuda-runner.cpp b/mlir/tools/mlir-cuda-runner/mlir-cuda-runner.cpp --- a/mlir/tools/mlir-cuda-runner/mlir-cuda-runner.cpp +++ b/mlir/tools/mlir-cuda-runner/mlir-cuda-runner.cpp @@ -125,7 +125,6 @@ int main(int argc, char **argv) { registerPassManagerCLOptions(); - mlir::registerAllDialects(); llvm::InitLLVM y(argc, argv); llvm::InitializeNativeTarget(); llvm::InitializeNativeTargetAsmPrinter(); diff --git a/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-gen.cpp b/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-gen.cpp --- a/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-gen.cpp +++ b/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-gen.cpp @@ -1703,7 +1703,7 @@ if (testEmitIncludeTdHeader) output->os() << "include \"mlir/Dialect/Linalg/IR/LinalgStructuredOps.td\""; - MLIRContext context(/*loadAllDialects=*/false); + MLIRContext context; llvm::SourceMgr mgr; mgr.AddNewSourceBuffer(std::move(file), llvm::SMLoc()); Parser parser(mgr, &context); diff --git a/mlir/tools/mlir-opt/mlir-opt.cpp b/mlir/tools/mlir-opt/mlir-opt.cpp --- a/mlir/tools/mlir-opt/mlir-opt.cpp +++ b/mlir/tools/mlir-opt/mlir-opt.cpp @@ -126,7 +126,6 @@ #endif int main(int argc, char **argv) { - registerAllDialects(); registerAllPasses(); #ifdef MLIR_INCLUDE_TESTS registerTestPasses(); diff --git a/mlir/tools/mlir-translate/mlir-translate.cpp b/mlir/tools/mlir-translate/mlir-translate.cpp --- a/mlir/tools/mlir-translate/mlir-translate.cpp +++ b/mlir/tools/mlir-translate/mlir-translate.cpp @@ -59,7 +59,6 @@ } int main(int argc, char **argv) { - registerAllDialects(); registerAllTranslations(); registerTestTranslations(); llvm::InitLLVM y(argc, argv); @@ -88,8 +87,9 @@ // Processes the memory buffer with a new MLIRContext. auto processBuffer = [&](std::unique_ptr ownedBuffer, raw_ostream &os) { - MLIRContext context(false); - registerAllDialects(&context); + MLIRContext context; + registerAllDialects(context.getDialectRegistry()); + // TODO: remove? context.allowUnregisteredDialects(); context.printOpOnDiagnostic(!verifyDiagnostics); llvm::SourceMgr sourceMgr; diff --git a/mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp b/mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp --- a/mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp +++ b/mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp @@ -53,7 +53,6 @@ llvm::llvm_shutdown_obj x; registerPassManagerCLOptions(); - mlir::registerAllDialects(); llvm::InitLLVM y(argc, argv); llvm::InitializeNativeTarget(); llvm::InitializeNativeTargetAsmPrinter(); diff --git a/mlir/unittests/Dialect/Quant/QuantizationUtilsTest.cpp b/mlir/unittests/Dialect/Quant/QuantizationUtilsTest.cpp --- a/mlir/unittests/Dialect/Quant/QuantizationUtilsTest.cpp +++ b/mlir/unittests/Dialect/Quant/QuantizationUtilsTest.cpp @@ -75,7 +75,7 @@ } TEST(QuantizationUtilsTest, convertFloatAttrUniform) { - MLIRContext ctx(/*loadAllDialects=*/false); + MLIRContext ctx; ctx.getOrLoadDialect(); IntegerType convertedType = IntegerType::get(8, &ctx); auto quantizedType = getTestQuantizedType(convertedType, &ctx); @@ -93,7 +93,7 @@ } TEST(QuantizationUtilsTest, convertRankedDenseAttrUniform) { - MLIRContext ctx(/*loadAllDialects=*/false); + MLIRContext ctx; ctx.getOrLoadDialect(); IntegerType convertedType = IntegerType::get(8, &ctx); auto quantizedType = getTestQuantizedType(convertedType, &ctx); @@ -118,7 +118,7 @@ } TEST(QuantizationUtilsTest, convertRankedSplatAttrUniform) { - MLIRContext ctx(/*loadAllDialects=*/false); + MLIRContext ctx; ctx.getOrLoadDialect(); IntegerType convertedType = IntegerType::get(8, &ctx); auto quantizedType = getTestQuantizedType(convertedType, &ctx); @@ -143,7 +143,7 @@ } TEST(QuantizationUtilsTest, convertRankedSparseAttrUniform) { - MLIRContext ctx(/*loadAllDialects=*/false); + MLIRContext ctx; ctx.getOrLoadDialect(); IntegerType convertedType = IntegerType::get(8, &ctx); auto quantizedType = getTestQuantizedType(convertedType, &ctx); diff --git a/mlir/unittests/Dialect/SPIRV/DeserializationTest.cpp b/mlir/unittests/Dialect/SPIRV/DeserializationTest.cpp --- a/mlir/unittests/Dialect/SPIRV/DeserializationTest.cpp +++ b/mlir/unittests/Dialect/SPIRV/DeserializationTest.cpp @@ -25,9 +25,6 @@ using namespace mlir; -/// Load the SPIRV dialect. -static DialectRegistration SPIRVRegistration; - using ::testing::StrEq; //===----------------------------------------------------------------------===// @@ -38,7 +35,7 @@ /// diagnostic checking utilities. class DeserializationTest : public ::testing::Test { protected: - DeserializationTest() : context(/*loadAllDialects=*/false) { + DeserializationTest() { context.getOrLoadDialect(); // Register a diagnostic handler to capture the diagnostic so that we can // check it later. diff --git a/mlir/unittests/Dialect/SPIRV/SerializationTest.cpp b/mlir/unittests/Dialect/SPIRV/SerializationTest.cpp --- a/mlir/unittests/Dialect/SPIRV/SerializationTest.cpp +++ b/mlir/unittests/Dialect/SPIRV/SerializationTest.cpp @@ -36,7 +36,7 @@ class SerializationTest : public ::testing::Test { protected: - SerializationTest() : context(/*loadAllDialects=*/false) { + SerializationTest() { context.getOrLoadDialect(); createModuleOp(); } diff --git a/mlir/unittests/IR/AttributeTest.cpp b/mlir/unittests/IR/AttributeTest.cpp --- a/mlir/unittests/IR/AttributeTest.cpp +++ b/mlir/unittests/IR/AttributeTest.cpp @@ -32,7 +32,7 @@ namespace { TEST(DenseSplatTest, BoolSplat) { - MLIRContext context(false); + MLIRContext context; IntegerType boolTy = IntegerType::get(1, &context); RankedTensorType shape = RankedTensorType::get({2, 2}, boolTy); @@ -57,7 +57,7 @@ TEST(DenseSplatTest, LargeBoolSplat) { constexpr int64_t boolCount = 56; - MLIRContext context(false); + MLIRContext context; IntegerType boolTy = IntegerType::get(1, &context); RankedTensorType shape = RankedTensorType::get({boolCount}, boolTy); @@ -80,7 +80,7 @@ } TEST(DenseSplatTest, BoolNonSplat) { - MLIRContext context(false); + MLIRContext context; IntegerType boolTy = IntegerType::get(1, &context); RankedTensorType shape = RankedTensorType::get({6}, boolTy); @@ -92,7 +92,7 @@ TEST(DenseSplatTest, OddIntSplat) { // Test detecting a splat with an odd(non 8-bit) integer bitwidth. - MLIRContext context(false); + MLIRContext context; constexpr size_t intWidth = 19; IntegerType intTy = IntegerType::get(intWidth, &context); APInt value(intWidth, 10); @@ -101,7 +101,7 @@ } TEST(DenseSplatTest, Int32Splat) { - MLIRContext context(false); + MLIRContext context; IntegerType intTy = IntegerType::get(32, &context); int value = 64; @@ -109,7 +109,7 @@ } TEST(DenseSplatTest, IntAttrSplat) { - MLIRContext context(false); + MLIRContext context; IntegerType intTy = IntegerType::get(85, &context); Attribute value = IntegerAttr::get(intTy, 109); @@ -117,7 +117,7 @@ } TEST(DenseSplatTest, F32Splat) { - MLIRContext context(false); + MLIRContext context; FloatType floatTy = FloatType::getF32(&context); float value = 10.0; @@ -125,7 +125,7 @@ } TEST(DenseSplatTest, F64Splat) { - MLIRContext context(false); + MLIRContext context; FloatType floatTy = FloatType::getF64(&context); double value = 10.0; @@ -133,7 +133,7 @@ } TEST(DenseSplatTest, FloatAttrSplat) { - MLIRContext context(false); + MLIRContext context; FloatType floatTy = FloatType::getF32(&context); Attribute value = FloatAttr::get(floatTy, 10.0); @@ -141,7 +141,7 @@ } TEST(DenseSplatTest, BF16Splat) { - MLIRContext context(false); + MLIRContext context; FloatType floatTy = FloatType::getBF16(&context); Attribute value = FloatAttr::get(floatTy, 10.0); @@ -149,7 +149,7 @@ } TEST(DenseSplatTest, StringSplat) { - MLIRContext context(false); + MLIRContext context; Type stringType = OpaqueType::get(Identifier::get("test", &context), "string", &context); StringRef value = "test-string"; @@ -157,7 +157,7 @@ } TEST(DenseSplatTest, StringAttrSplat) { - MLIRContext context(false); + MLIRContext context; Type stringType = OpaqueType::get(Identifier::get("test", &context), "string", &context); Attribute stringAttr = StringAttr::get("test-string", stringType); @@ -165,28 +165,28 @@ } TEST(DenseComplexTest, ComplexFloatSplat) { - MLIRContext context(false); + MLIRContext context; ComplexType complexType = ComplexType::get(FloatType::getF32(&context)); std::complex value(10.0, 15.0); testSplat(complexType, value); } TEST(DenseComplexTest, ComplexIntSplat) { - MLIRContext context(false); + MLIRContext context; ComplexType complexType = ComplexType::get(IntegerType::get(64, &context)); std::complex value(10, 15); testSplat(complexType, value); } TEST(DenseComplexTest, ComplexAPFloatSplat) { - MLIRContext context(false); + MLIRContext context; ComplexType complexType = ComplexType::get(FloatType::getF32(&context)); std::complex value(APFloat(10.0f), APFloat(15.0f)); testSplat(complexType, value); } TEST(DenseComplexTest, ComplexAPIntSplat) { - MLIRContext context(false); + MLIRContext context; ComplexType complexType = ComplexType::get(IntegerType::get(64, &context)); std::complex value(APInt(64, 10), APInt(64, 15)); testSplat(complexType, value); diff --git a/mlir/unittests/IR/DialectTest.cpp b/mlir/unittests/IR/DialectTest.cpp --- a/mlir/unittests/IR/DialectTest.cpp +++ b/mlir/unittests/IR/DialectTest.cpp @@ -26,7 +26,7 @@ }; TEST(DialectDeathTest, MultipleDialectsWithSameNamespace) { - MLIRContext context(false); + MLIRContext context; // Registering a dialect with the same namespace twice should result in a // failure. diff --git a/mlir/unittests/IR/OperationSupportTest.cpp b/mlir/unittests/IR/OperationSupportTest.cpp --- a/mlir/unittests/IR/OperationSupportTest.cpp +++ b/mlir/unittests/IR/OperationSupportTest.cpp @@ -25,7 +25,7 @@ namespace { TEST(OperandStorageTest, NonResizable) { - MLIRContext context(false); + MLIRContext context; Builder builder(&context); Operation *useOp = @@ -49,7 +49,7 @@ } TEST(OperandStorageTest, Resizable) { - MLIRContext context(false); + MLIRContext context; Builder builder(&context); Operation *useOp = @@ -77,7 +77,7 @@ } TEST(OperandStorageTest, RangeReplace) { - MLIRContext context(false); + MLIRContext context; Builder builder(&context); Operation *useOp = @@ -113,7 +113,7 @@ } TEST(OperandStorageTest, MutableRange) { - MLIRContext context(false); + MLIRContext context; Builder builder(&context); Operation *useOp = diff --git a/mlir/unittests/Pass/AnalysisManagerTest.cpp b/mlir/unittests/Pass/AnalysisManagerTest.cpp --- a/mlir/unittests/Pass/AnalysisManagerTest.cpp +++ b/mlir/unittests/Pass/AnalysisManagerTest.cpp @@ -29,7 +29,7 @@ }; TEST(AnalysisManagerTest, FineGrainModuleAnalysisPreservation) { - MLIRContext context(false); + MLIRContext context; // Test fine grain invalidation of the module analysis manager. OwningModuleRef module(ModuleOp::create(UnknownLoc::get(&context))); @@ -50,7 +50,7 @@ } TEST(AnalysisManagerTest, FineGrainFunctionAnalysisPreservation) { - MLIRContext context(false); + MLIRContext context; Builder builder(&context); // Create a function and a module. @@ -79,7 +79,7 @@ } TEST(AnalysisManagerTest, FineGrainChildFunctionAnalysisPreservation) { - MLIRContext context(false); + MLIRContext context; Builder builder(&context); // Create a function and a module. @@ -122,7 +122,7 @@ }; TEST(AnalysisManagerTest, CustomInvalidation) { - MLIRContext context(false); + MLIRContext context; Builder builder(&context); // Create a function and a module. diff --git a/mlir/unittests/SDBM/SDBMTest.cpp b/mlir/unittests/SDBM/SDBMTest.cpp --- a/mlir/unittests/SDBM/SDBMTest.cpp +++ b/mlir/unittests/SDBM/SDBMTest.cpp @@ -19,7 +19,7 @@ static MLIRContext *ctx() { - static thread_local MLIRContext context(false); + static thread_local MLIRContext context; context.getOrLoadDialect(); return &context; } diff --git a/mlir/unittests/TableGen/OpBuildGen.cpp b/mlir/unittests/TableGen/OpBuildGen.cpp --- a/mlir/unittests/TableGen/OpBuildGen.cpp +++ b/mlir/unittests/TableGen/OpBuildGen.cpp @@ -26,7 +26,7 @@ //===----------------------------------------------------------------------===// static MLIRContext &getContext() { - static MLIRContext ctx(false); + static MLIRContext ctx; ctx.getOrLoadDialect(); return ctx; } diff --git a/mlir/unittests/TableGen/StructsGenTest.cpp b/mlir/unittests/TableGen/StructsGenTest.cpp --- a/mlir/unittests/TableGen/StructsGenTest.cpp +++ b/mlir/unittests/TableGen/StructsGenTest.cpp @@ -42,7 +42,7 @@ /// Validates that test::TestStruct::classof correctly identifies a valid /// test::TestStruct. TEST(StructsGenTest, ClassofTrue) { - mlir::MLIRContext context(false); + mlir::MLIRContext context; auto structAttr = getTestStruct(&context); ASSERT_TRUE(test::TestStruct::classof(structAttr)); }