File tree Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -274,6 +274,9 @@ class PassManager : public OpPassManager {
274274 // / Runs the verifier after each individual pass.
275275 void enableVerifier (bool enabled = true );
276276
277+ // / Whether dependent dialects should be automatically loaded.
278+ void setAutomaticDialectLoading (bool shouldLoad);
279+
277280 // ===--------------------------------------------------------------------===//
278281 // Instrumentations
279282 // ===--------------------------------------------------------------------===//
@@ -496,6 +499,9 @@ class PassManager : public OpPassManager {
496499
497500 // / A flag that indicates if the IR should be verified in between passes.
498501 bool verifyPasses : 1 ;
502+
503+ // / A flag to disable dependent dialect registration.
504+ bool loadDialects : 1 ;
499505};
500506
501507// / Register a set of useful command-line options that can be used to configure
Original file line number Diff line number Diff line change @@ -853,11 +853,13 @@ LogicalResult PassManager::run(Operation *op) {
853853 << op->getName () << " ' op" ;
854854
855855 // Register all dialects for the current pipeline.
856- DialectRegistry dependentDialects;
857- getDependentDialects (dependentDialects);
858- context->appendDialectRegistry (dependentDialects);
859- for (StringRef name : dependentDialects.getDialectNames ())
860- context->getOrLoadDialect (name);
856+ if (loadDialects) {
857+ DialectRegistry dependentDialects;
858+ getDependentDialects (dependentDialects);
859+ context->appendDialectRegistry (dependentDialects);
860+ for (StringRef name : dependentDialects.getDialectNames ())
861+ context->getOrLoadDialect (name);
862+ }
861863
862864 // Before running, make sure to finalize the pipeline pass list.
863865 if (failed (getImpl ().finalizePassList (context)))
@@ -893,6 +895,11 @@ LogicalResult PassManager::run(Operation *op) {
893895 return result;
894896}
895897
898+
899+ void PassManager::setAutomaticDialectLoading (bool shouldLoad) {
900+ loadDialects = shouldLoad;
901+ }
902+
896903// / Add the provided instrumentation to the pass manager.
897904void PassManager::addInstrumentation (std::unique_ptr<PassInstrumentation> pi) {
898905 if (!instrumentor)
You can’t perform that action at this time.
0 commit comments