Files
llvm-project/mlir/lib/Interfaces/LoopLikeInterface.cpp
Ivan Butygin 9c3029774a [mlir] Defer LoopLikeOpInterface type checks to RegionBranchOpInterface (#184116)
`LoopLikeOpInterface`'s verifier hardcodes type equality checks for
init/iter_arg/yield/result edges. This prevents downstream ops with
compatible-but-unequal types from using the pass verifier, since there
is no override mechanism.

`RegionBranchOpInterface` already verifies types along all control-flow
edges and provides an overridable `areTypesCompatible` hook. In
practice,
most loop ops implement both interfaces, making the
`LoopLikeOpInterface`
type checks redundant (the existing code even had a comment
acknowledging
this).

This PR removes the redundant type checks from `LoopLikeOpInterface`
when the op also implements `RegionBranchOpInterface`, letting that
interface handle type compatibility (including any custom
`areTypesCompatible` overrides). For ops that only implement
`LoopLikeOpInterface` (e.g. `affine.parallel`, `tosa.while_loop`), the
strict type equality checks are retained as a fallback. the verifier's
loop-result check to use structured bindings with `llvm::enumerate` and
remove dead variables.
2026-03-06 15:43:00 +03:00

5.1 KiB