This is an archive of the discontinued LLVM Phabricator instance.

[mlir][arith] Mark unknown types legal in WIE
ClosedPublic

Authored by kuhar on Oct 3 2022, 7:40 PM.

Details

Summary

Allow unknown types to pass through without being marked as illegal.

Diff Detail

Event Timeline

kuhar created this revision.Oct 3 2022, 7:40 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 3 2022, 7:40 PM
kuhar requested review of this revision.Oct 3 2022, 7:40 PM
kuhar updated this revision to Diff 464877.Oct 3 2022, 7:41 PM

Drop an accidental include.

kuhar updated this revision to Diff 464878.Oct 3 2022, 7:42 PM

Fix test function name

antiagainst requested changes to this revision.Oct 4 2022, 10:06 AM
antiagainst added inline comments.
mlir/lib/Dialect/Arith/Transforms/EmulateWideInt.cpp
644

Should we actually add addConversion([](Type type) -> Optional<Type> { return type; }); at L629 to let all other types pass through? There can exist dialect types we don't know about at all.

This revision now requires changes to proceed.Oct 4 2022, 10:06 AM
kuhar added inline comments.Oct 4 2022, 10:11 AM
mlir/lib/Dialect/Arith/Transforms/EmulateWideInt.cpp
644

Originally, I thought that out-of-tree passes would be able to add custom conversions to this type converter to support whatever types they need.
I looked at how the type converter works and it attempts conversions one by one in reverse order, so adding the Type -> Type as a base conversion should also work. Custom conversions added outside of this constructors should be picked up first.

Thanks for the suggestion!

kuhar updated this revision to Diff 465067.Oct 4 2022, 10:15 AM

Allow all unknown types to pass through.

kuhar retitled this revision from [mlir][arith] Mark index and floating types legal in WIE to [mlir][arith] Mark unknown types legal in WIE.Oct 4 2022, 10:16 AM
kuhar edited the summary of this revision. (Show Details)
kuhar marked an inline comment as done.
antiagainst accepted this revision.Oct 4 2022, 11:02 AM
This revision is now accepted and ready to land.Oct 4 2022, 11:02 AM
This revision was automatically updated to reflect the committed changes.