In my dialect, I have an Op
FooOp that has a folder and a canonicalization pattern (i.e.,
hasFolder = 1 and
hasCanonicalizer = 1). Both of them work together (in the canonicalization pass) to produce the canonical form of
FooOp. The folder alone will leave
FooOp in a partially canonicalized state that is awkward for my subsequent dialect conversion passes.
A dialect conversion pass will attempt to “legalize” Ops using the
OperationLegalizer. The legalizer will call a method called
legalizeWithFold to try folding the Ops. As you can guess, that leaves
FooOp in an awkward partially canonicalized state.
Of course, I can always run the canonicalizer pass before dialect conversion and that’s fine. However, I got curious:
Would it make sense to have a
legalizeWithCanonicalization method instead ?
Such method will basically run the full canonicalization pass before dialect conversions.
Thank you in advance !