[Mlir-commits] [mlir] [mlir][Pass] Enable the option for reproducer generation without crashing (PR #75421)
Mehdi Amini
llvmlistbot at llvm.org
Tue Jan 2 06:38:24 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};
+ ::printAsTextualPipeline(os, anchorName, passes);
----------------
joker-eph wrote:
Or even directly:
```suggestion
::printAsTextualPipeline(os, anchorName, {impl->passes.begin(), impl->passes.end()});
```
https://github.com/llvm/llvm-project/pull/75421
More information about the Mlir-commits
mailing list