Check for Vector or Tensor Type rather than ShapedType when matching constant splat

Only vectors or tensors can be constant splats (or element attrs). This is in preparation for making MemRef subclass ShapedType

--

PiperOrigin-RevId: 250586281
This commit is contained in:
Geoffrey Martin-Noble 2019-05-29 16:06:49 -07:00 committed by Mehdi Amini
parent 9ebab7bc30
commit 17022b1bc5
1 changed files with 1 additions and 1 deletions
mlir/include/mlir/IR

View 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());