diff --git a/mlir/include/mlir/IR/Attributes.h b/mlir/include/mlir/IR/Attributes.h --- a/mlir/include/mlir/IR/Attributes.h +++ b/mlir/include/mlir/IR/Attributes.h @@ -887,9 +887,12 @@ ElementIterator(rawData, splat, getNumElements())}; } - llvm::iterator_range::iterator> getValues() const { - auto stringRefs = getStringValues(); - return {stringRefs.begin(), stringRefs.end()}; + llvm::iterator_range> getValues() const { + auto stringRefs = getStringRefs(); + const char *ptr = reinterpret_cast(stringRefs.data()); + bool splat = isSplat(); + return {ElementIterator(ptr, splat, 0), + ElementIterator(ptr, splat, getNumElements())}; } /// Return the held element values as a range of Attributes. diff --git a/mlir/lib/IR/AsmPrinter.cpp b/mlir/lib/IR/AsmPrinter.cpp --- a/mlir/lib/IR/AsmPrinter.cpp +++ b/mlir/lib/IR/AsmPrinter.cpp @@ -1471,7 +1471,7 @@ static void printDenseStringElement(DenseStringElementsAttr attr, raw_ostream &os, unsigned index) { os << "\""; - printEscapedString(attr.getStringValues()[index], os); + printEscapedString(attr.getStringRefs()[index], os); os << "\""; }