[AVX] Make CodeInit Unique

Use a StringMap to ensure CodeInits are unique and created only
once.

llvm-svn: 136492
This commit is contained in:
David Greene 2011-07-29 19:07:15 +00:00
parent 3ff33c9123
commit 3468b0f483
1 changed files with 6 additions and 1 deletions

View File

@ -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) {