[mlir][spirv] Fix extended insts deserialization generation

This change replaces container used for storing temporary
strings for generated code to std::list.
SmallVector may reallocate internal data, which will invalidate
references when more than one extended instruction set is
generated.

Reviewed By: mravishankar, antiagainst

Differential Revision: https://reviews.llvm.org/D88626
This commit is contained in:
Konrad Dobros 2020-10-06 13:33:41 -04:00 committed by Lei Zhang
parent e4a9e4ef55
commit c9f1c50fc0
1 changed files with 3 additions and 1 deletions

View File

@ -27,6 +27,8 @@
#include "llvm/TableGen/Record.h"
#include "llvm/TableGen/TableGenBackend.h"
#include <list>
using llvm::ArrayRef;
using llvm::formatv;
using llvm::raw_ostream;
@ -1031,7 +1033,7 @@ emitExtendedSetDeserializationDispatch(const RecordKeeper &recordKeeper,
// raw_string_ostream needs a string&, use a vector to store all the string
// that are captured by reference within raw_string_ostream.
StringMap<raw_string_ostream> extensionSets;
SmallVector<std::string, 1> extensionSetNames;
std::list<std::string> extensionSetNames;
initExtendedSetDeserializationDispatch(extensionSetName, instructionID, words,
os);