ShapedType just indicates shape/rank/element semantics. It's generally not useful for other type checking. This check already checks for vector or tensor type, so we can use a direct cast if we check those first.
Related to making MemRefType a subclass of ShapedType
--
PiperOrigin-RevId:
250583231
bool isHandledType(Type t) const final {
if (t.isa<FloatType>())
return true;
- auto shapedType = t.dyn_cast<ShapedType>();
- return (shapedType && shapedType.getElementType().isa<FloatType>() &&
- (t.isa<VectorType>() || t.isa<TensorType>()));
+ return (t.isa<VectorType>() || t.isa<TensorType>()) &&
+ t.cast<ShapedType>().getElementType().isa<FloatType>();
}
void finalizeAnchors(CAGSlice &cag) const override {