llvm-project
8b15fc14 - [CIR] Fix FlattenCFG pattern rewriter contract violations (#192359)

Commit
7 days ago
[CIR] Fix FlattenCFG pattern rewriter contract violations (#192359) Fix patterns in CIRFlattenCFGPass that modify IR but return failure(), violating the MLIR greedy pattern rewriter contract. The contract requires that if a pattern modifies IR, it must return success(). - CIRCleanupScopeOpFlattening: always return success() since IR is modified (blocks split, regions inlined) before error paths - Ternary op flattening: return success() instead of falling through after emitError, since splitBlock/createBlock already modified IR - Use rewriter.moveOpBefore() instead of direct defOp->moveBefore() to properly notify the rewriter of IR mutations Found by MLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS=ON. Test: flatten-cleanup-scope-nyi.cir (a silly one since it's testing an error, but point still valid)
Author
Parents
Loading