Dialect conversion infrastructure supports 1->N type conversions by requiring individual conversions to provide facilities to generate operations retrofitting N values into 1 of the original type when N > 1. This functionality can also be used to materialize explicit "cast"-like operations, but it did not support 1->1 type conversions until now. Modify TypeConverter to support materialization of cast operations for 1-1 conversions. This also makes materialization specification more extensible following the same pattern as type conversions. Instead of overloading a virtual function, users or subclasses of TypeConversion can now register type-specific materialization callbacks that will be called in order for the given type.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
(Sorry for the delay)
Looks really clean, thanks!
mlir/include/mlir/Transforms/DialectConversion.h | ||
---|---|---|
116 | typo: convertibe | |
117 | nit: form: | |
162 | Can we remove the virtual here? That should enable removing the vtable completely. | |
mlir/lib/Transforms/DialectConversion.cpp | ||
319 | Are these duplicated from below? | |
389 | nit: Can you just use an if for the initialization? Value newArg; if (typeConverter) newArg = ... |
(Sorry for the delay)
No worries! Flang folks seemed to need it, but they did not insist in the end.
mlir/include/mlir/Transforms/DialectConversion.h | ||
---|---|---|
162 | I don't see any in-tree overrides of this, but let's do it as a separate commit in case somebody depends on it. | |
mlir/lib/Transforms/DialectConversion.cpp | ||
319 | Indeed, removed. |
typo: convertibe