Check for Vector or Tensor Type rather than ShapedType when matching constant...
authorGeoffrey Martin-Noble <gcmn@google.com>
Wed, 29 May 2019 23:06:49 +0000 (16:06 -0700)
committerMehdi Amini <joker.eph@gmail.com>
Sun, 2 Jun 2019 03:09:32 +0000 (20:09 -0700)
    Only vectors or tensors can be constant splats (or element attrs). This is in preparation for making MemRef subclass ShapedType

--

PiperOrigin-RevId: 250586281

mlir/include/mlir/IR/Matchers.h

index d1c2f94..61796ff 100644 (file)
@@ -101,7 +101,7 @@ struct constant_int_op_binder {
     if (type.isa<IntegerType>()) {
       return attr_value_binder<IntegerAttr>(bind_value).match(attr);
     }
-    if (type.isa<ShapedType>()) {
+    if (type.isa<VectorType>() || type.isa<RankedTensorType>()) {
       if (auto splatAttr = attr.dyn_cast<SplatElementsAttr>()) {
         return attr_value_binder<IntegerAttr>(bind_value)
             .match(splatAttr.getValue());