diff --git a/mlir/lib/IR/BuiltinAttributes.cpp b/mlir/lib/IR/BuiltinAttributes.cpp --- a/mlir/lib/IR/BuiltinAttributes.cpp +++ b/mlir/lib/IR/BuiltinAttributes.cpp @@ -677,10 +677,11 @@ ArrayRef values) { assert(hasSameElementsOrSplat(type, values)); - // If the element type is not based on int/float/index, assume it is a string - // type. + // If the element type is an int/float/index or a complex/tensor assume it is + // a string type. auto eltType = type.getElementType(); - if (!type.getElementType().isIntOrIndexOrFloat()) { + if (!eltType.isIntOrIndexOrFloat() && !eltType.isa() && + !eltType.isa()) { SmallVector stringValues; stringValues.reserve(values.size()); for (Attribute attr : values) {