Avoid dyn_cast to ShapedType

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
This commit is contained in:
Geoffrey Martin-Noble 2019-05-29 15:51:17 -07:00 committed by Mehdi Amini
parent 66e84bf88c
commit 9ebab7bc30
1 changed files with 2 additions and 3 deletions
mlir/lib/Quantizer/Configurations

View File

@ -96,9 +96,8 @@ struct FxpMathTargetConfigImpl : public FxpMathTargetConfig {
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 {