Thank you, that does make sense. I guess for my simple case it always happens to work but could cause bugs in the future.
The issue is that I couldn’t figure out how to apply ConversionPatterns to ops that should remain legal in both the source and the target dialect during a lowering pass.
In particular, I have “call” ops from the standard dialect mixed with a bunch of ops from my own dialect. I then have a pass during which I want to lower to exclusively ops from the standard dialect.
So I added my dialect as an illegal dialect. But then, patterns are not being applied to call ops, because they are already considered legal. Is there a way to force patterns to also be applied to ops which are legal in both the source and target dialect? Ie. I only want to change the type of the call op, but keep the op itself.
Is the way to do this to use a canonicaliser pass instead of a lowering pass?