Don't use ShapedType to indicate vector or tensor type
authorGeoffrey Martin-Noble <gcmn@google.com>
Fri, 31 May 2019 20:01:45 +0000 (13:01 -0700)
committerMehdi Amini <joker.eph@gmail.com>
Sun, 2 Jun 2019 03:12:31 +0000 (20:12 -0700)
    MemRefType may soon subclass ShapedType. ShapedType only guarantees that something has a shape (possibly dynamic), rank (or explicitly unranked), and fixed element type.

--

PiperOrigin-RevId: 250940537

mlir/lib/EDSC/Builders.cpp

index 5c17454..22f9139 100644 (file)
@@ -331,7 +331,8 @@ static ValueHandle createBinaryHandle(
     return createBinaryHandle<IOp>(lhs, rhs);
   } else if (thisType.isa<FloatType>()) {
     return createBinaryHandle<FOp>(lhs, rhs);
-  } else if (auto aggregateType = thisType.dyn_cast<ShapedType>()) {
+  } else if (thisType.isa<VectorType>() || thisType.isa<TensorType>()) {
+    auto aggregateType = thisType.cast<ShapedType>();
     if (aggregateType.getElementType().isa<IntegerType>())
       return createBinaryHandle<IOp>(lhs, rhs);
     else if (aggregateType.getElementType().isa<FloatType>())