[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:28:31 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 one was pretty problematic to get building, keep getting build errors like:

`....llvm/include/llvm/ADT/iterator.h:328:70: error: no matching function for call to ‘llvm::iterator_adaptor_base<llvm::pointee_iterator<std::unique_ptr<mlir::Pass>*>, std::unique_ptr<mlir::Pass>*, std::random_access_iterator_tag, mlir::Pass, long int, mlir::Pass*, mlir::Pass&>::iterator_adaptor_base(__gnu_cxx::__normal_iterator<std::unique_ptr<mlir::Pass>*, std::vector<std::unique_ptr<mlir::Pass>, std::allocator<std::unique_ptr<mlir::Pass> > > >)’
  328 |       : pointee_iterator::iterator_adaptor_base(std::forward<U &&>(u)) {}`

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


More information about the Mlir-commits mailing list