From 9ebab7bc30bf7cd5fcad13037f76991a6311ad78 Mon Sep 17 00:00:00 2001 From: Geoffrey Martin-Noble Date: Wed, 29 May 2019 15:51:17 -0700 Subject: [PATCH] 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 --- mlir/lib/Quantizer/Configurations/FxpMathConfig.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mlir/lib/Quantizer/Configurations/FxpMathConfig.cpp b/mlir/lib/Quantizer/Configurations/FxpMathConfig.cpp index 8623df9..d512c4d 100644 --- a/mlir/lib/Quantizer/Configurations/FxpMathConfig.cpp +++ b/mlir/lib/Quantizer/Configurations/FxpMathConfig.cpp @@ -96,9 +96,8 @@ struct FxpMathTargetConfigImpl : public FxpMathTargetConfig { bool isHandledType(Type t) const final { if (t.isa()) return true; - auto shapedType = t.dyn_cast(); - return (shapedType && shapedType.getElementType().isa() && - (t.isa() || t.isa())); + return (t.isa() || t.isa()) && + t.cast().getElementType().isa(); } void finalizeAnchors(CAGSlice &cag) const override { -- 2.7.4