Page MenuHomePhabricator

[mlir] Remove instance methods from LLVMType
ClosedPublic

Authored by ftynse on Dec 22 2020, 2:22 AM.

Details

Summary

LLVMType contains multiple instance methods that were introduced initially for
compatibility with LLVM API. These methods boil down to cast followed by
type-specific call. Arguably, they are mostly used in an LLVM cast-follows-isa
anti-pattern. This doesn't connect nicely to the rest of the MLIR
infrastructure and actively prevents it from making the LLVM dialect type
system more open, e.g., reusing built-in types when appropriate. Remove such
instance methods and replaces their uses with apporpriate casts and methods on
derived classes. In some cases, the result may look slightly more verbose, but
most cases should actually use a stricter subtype of LLVMType anyway and avoid
the isa/cast.

Diff Detail

Event Timeline

ftynse created this revision.Dec 22 2020, 2:22 AM
ftynse requested review of this revision.Dec 22 2020, 2:22 AM
Herald added a project: Restricted Project. · View Herald Transcript
ftynse edited the summary of this revision. (Show Details)Dec 22 2020, 2:23 AM
mehdi_amini accepted this revision.Dec 22 2020, 9:44 AM

Thanks for the cleanup :)

LGTM

This revision is now accepted and ready to land.Dec 22 2020, 9:44 AM
This revision was automatically updated to reflect the committed changes.