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 @@ -1307,8 +1307,13 @@ if (eltType.isa()) return FloatAttr::get(eltType, 0); + // Handle string type. + if (DenseStringElementsAttr denseAttr = + getValues().dyn_cast()) { + return StringAttr::get("", denseAttr.getType()); + } + // Otherwise, this is an integer. - // TODO: Handle StringAttr here. return IntegerAttr::get(eltType, 0); }