[Mlir-commits] [mlir] [mlir][Pass] Enable the option for reproducer generation without crashing (PR #75421)

Puyan Lotfi llvmlistbot at llvm.org
Tue Jan 2 16:37:50 PST 2024


================
@@ -382,16 +382,23 @@ StringRef OpPassManager::getOpAnchorName() const {
 
 /// Prints out the passes of the pass manager as the textual representation
 /// of pipelines.
-void OpPassManager::printAsTextualPipeline(raw_ostream &os) const {
-  os << getOpAnchorName() << "(";
+void printAsTextualPipeline(
+    raw_ostream &os, StringRef anchorName,
+    const llvm::iterator_range<OpPassManager::pass_iterator> &passes) {
+  os << anchorName << "(";
   llvm::interleave(
-      impl->passes,
-      [&](const std::unique_ptr<Pass> &pass) {
-        pass->printAsTextualPipeline(os);
-      },
+      passes, [&](mlir::Pass &pass) { pass.printAsTextualPipeline(os); },
       [&]() { os << ","; });
   os << ")";
 }
+void OpPassManager::printAsTextualPipeline(raw_ostream &os) const {
+  StringRef anchorName = getOpAnchorName();
+  auto *begin = MutableArrayRef<std::unique_ptr<Pass>>{impl->passes}.begin();
+  auto *end = MutableArrayRef<std::unique_ptr<Pass>>{impl->passes}.end();
+  const llvm::iterator_range<OpPassManager::pass_iterator> passes = {begin,
+                                                                     end};
----------------
plotfi wrote:

This works however:

```
::printAsTextualPipeline(os, anchorName, {
   MutableArrayRef<std::unique_ptr<Pass>>{impl->passes}.begin(),
   MutableArrayRef<std::unique_ptr<Pass>>{impl->passes}.end()
});
```

https://github.com/llvm/llvm-project/pull/75421


More information about the Mlir-commits mailing list