[clang] [CIR] Switch FlattenCFGPass to no longer use greedy manager. (PR #211368)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 23 06:37:15 PDT 2026
================
@@ -2001,20 +2001,43 @@ void populateFlattenCFGPatterns(RewritePatternSet &patterns) {
}
void CIRFlattenCFGPass::runOnOperation() {
- RewritePatternSet patterns(&getContext());
- populateFlattenCFGPatterns(patterns);
-
- // Collect operations to apply patterns.
- llvm::SmallVector<Operation *, 16> ops;
- getOperation()->walk<mlir::WalkOrder::PostOrder>([&](Operation *op) {
- if (isa<IfOp, ScopeOp, SwitchOp, LoopOpInterface, TernaryOp, CleanupScopeOp,
- TryOp>(op))
- ops.push_back(op);
- });
+ RewritePatternSet patternList(&getContext());
+ populateFlattenCFGPatterns(patternList);
+ FrozenRewritePatternSet patterns(std::move(patternList));
+
+ PatternApplicator applicator(patterns);
+ // We need _A_ cost model, and everything here is the same cost-model, so this
+ // is effectively a no-op, but necessary to use the PatternApplicator.
+ applicator.applyDefaultCostModel();
+
+ mlir::PatternRewriter rewriter(&getContext());
+
----------------
erichkeane wrote:
Don't like that one too :D Ok th en.
https://github.com/llvm/llvm-project/pull/211368
More information about the cfe-commits
mailing list