[Mlir-commits] [mlir] [mlir][Transforms] Dialect Conversion: Convert entry block only (PR #165180)
Han-Chung Wang
llvmlistbot at llvm.org
Tue Nov 4 11:05:41 PST 2025
hanhanW wrote:
> > Makes sense to me. I tried integrating downstream and am only seeing a single failure [iree-org/iree#22520](https://github.com/iree-org/iree/pull/22520).
>
> The crash is due to a rollback of the function conversion patterns. There is a test case with unstructured control flow. You have to change the conversion target to no longer take into account non-entry block signatures of function ops:
>
> ```c++
> // Operations are legal if they don't contain any illegal type.
> target.markUnknownOpDynamicallyLegal([&](Operation *op) {
> if (auto globalOp = dyn_cast<IREE::Util::GlobalOpInterface>(op)) {
> return typeConverter.isLegal(globalOp.getGlobalType());
> } else if (auto funcOp = dyn_cast<mlir::FunctionOpInterface>(op)) {
> // ...
>
> // DELETE THIS:
> for (auto ®ion : op->getRegions()) {
> if (!typeConverter.isLegal(®ion))
> return false;
> }
> return true;
> });
> ```
>
> Then, populate the new structural CF conversion patterns and use them instead of the "generic" pattern to conversion `cf.br` and `cf.cond_br`. These patterns will also convert the block signatures.
Thanks, it does fix the issue.
https://github.com/llvm/llvm-project/pull/165180
More information about the Mlir-commits
mailing list