[MLIR][Transform] Fix crash in CheckUses when op lacks MemoryEffectOpInterface (#188998)
collectFreedValues used cast<MemoryEffectOpInterface> unconditionally on
every op encountered during the walk. Ops that do not implement the
interface (e.g. pdl.pattern, pdl.operands, pdl.types inside a
transform.with_pdl_patterns region) trigger the cast assertion, crashing
mlir-opt when -transform-dialect-check-uses is requested.
Change the cast to dyn_cast and skip ops that don't implement the
interface; they cannot free transform values and are safely ignored.
Fixes #120944
Assisted-by: Claude Code