diff options
| author | Mehdi Amini <joker.eph@gmail.com> | 2025-08-14 15:36:46 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-14 15:36:46 +0200 |
| commit | df57d6a01e85ca78da2febab21b268d9fd6955a0 (patch) | |
| tree | 19b0aab453e6bc7e2b15d3220024dfdacd4fa57e /mlir/test/lib/Dialect/Test/TestPatterns.cpp | |
| parent | df86ea61b7ed484ca797f96d7ad40fd9ada7ba30 (diff) | |
| parent | 7bda76367f19cfc19086f68d9dd5ac019a9ceccd (diff) | |
Merge branch 'main' into users/joker-eph-python-bindings-maintainersusers/joker-eph-python-bindings-maintainers
Diffstat (limited to 'mlir/test/lib/Dialect/Test/TestPatterns.cpp')
| -rw-r--r-- | mlir/test/lib/Dialect/Test/TestPatterns.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/mlir/test/lib/Dialect/Test/TestPatterns.cpp b/mlir/test/lib/Dialect/Test/TestPatterns.cpp index ff958d9a3d2b..657dfd2bac6e 100644 --- a/mlir/test/lib/Dialect/Test/TestPatterns.cpp +++ b/mlir/test/lib/Dialect/Test/TestPatterns.cpp @@ -1177,8 +1177,8 @@ struct TestNonRootReplacement : public RewritePattern { auto illegalOp = ILLegalOpF::create(rewriter, op->getLoc(), resultType); auto legalOp = LegalOpB::create(rewriter, op->getLoc(), resultType); - rewriter.replaceOp(illegalOp, legalOp); rewriter.replaceOp(op, illegalOp); + rewriter.replaceOp(illegalOp, legalOp); return success(); } }; @@ -1362,6 +1362,7 @@ public: // Helper function that replaces the given op with a new op of the given // name and doubles each result (1 -> 2 replacement of each result). auto replaceWithDoubleResults = [&](Operation *op, StringRef name) { + rewriter.setInsertionPointAfter(op); SmallVector<Type> types; for (Type t : op->getResultTypes()) { types.push_back(t); @@ -1560,6 +1561,7 @@ struct TestLegalizePatternDriver if (mode == ConversionMode::Partial) { DenseSet<Operation *> unlegalizedOps; ConversionConfig config; + config.allowPatternRollback = allowPatternRollback; DumpNotifications dumpNotifications; config.listener = &dumpNotifications; config.unlegalizedOps = &unlegalizedOps; @@ -1582,6 +1584,7 @@ struct TestLegalizePatternDriver }); ConversionConfig config; + config.allowPatternRollback = allowPatternRollback; DumpNotifications dumpNotifications; config.foldingMode = foldingMode; config.listener = &dumpNotifications; @@ -1599,6 +1602,7 @@ struct TestLegalizePatternDriver DenseSet<Operation *> legalizedOps; ConversionConfig config; config.foldingMode = foldingMode; + config.allowPatternRollback = allowPatternRollback; config.legalizableOps = &legalizedOps; if (failed(applyAnalysisConversion(getOperation(), target, std::move(patterns), config))) @@ -1634,6 +1638,9 @@ struct TestLegalizePatternDriver "after-patterns", "Only attempt to fold not legal operations " "after applying patterns"))}; + Option<bool> allowPatternRollback{*this, "allow-pattern-rollback", + llvm::cl::desc("Allow pattern rollback"), + llvm::cl::init(true)}; }; } // namespace |
