llvm-project
5c06541f - [mlir][CFGToSCF] Fix crash when region contains unconvertible multi-successor op (#183935)

Commit
37 days ago
[mlir][CFGToSCF] Fix crash when region contains unconvertible multi-successor op (#183935) `transformCFGToSCF` would crash with a use-list assertion when it encountered an op like `spirv.BranchConditional` that implements `BranchOpInterface` (passing the existing precondition checks) but is not handled by `createStructuredBranchRegionOp`. The algorithm mutated the IR significantly before discovering the op was unsupported, leaving it in a corrupt half-transformed state that triggered the assertion on teardown. Fix by adding `canConvertBranchOp` to `CFGToSCFInterface` (default: accept all ops) and calling it inside `checkTransformationPreconditions` for every block with more than one successor, before any IR modifications are made. `ControlFlowToSCFTransformation` overrides the method to accept only `cf.cond_br` and `cf.switch`. Fixes #173566 Assisted-by: Claude Code
Author
Parents
Loading