diff options
Diffstat (limited to 'llvm/utils/TableGen/Record.cpp')
-rw-r--r-- | llvm/utils/TableGen/Record.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/utils/TableGen/Record.cpp b/llvm/utils/TableGen/Record.cpp index ee5db4713dc..133a1581c0e 100644 --- a/llvm/utils/TableGen/Record.cpp +++ b/llvm/utils/TableGen/Record.cpp @@ -575,7 +575,12 @@ const StringInit *StringInit::get(const std::string &V) { } const CodeInit *CodeInit::get(const std::string &V) { - return new CodeInit(V); + typedef StringMap<CodeInit *> Pool; + static Pool ThePool; + + CodeInit *&I = ThePool[V]; + if (!I) I = new CodeInit(V); + return I; } const ListInit *ListInit::get(ArrayRef<const Init *> Range, RecTy *EltTy) { |