Skip to content

Commit

Permalink
[AVX] Make IntInit Unique
Browse files Browse the repository at this point in the history
Use a DenseMap to make sure only one IntInit of any value exists.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136490 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
greened committed Jul 29, 2011
1 parent 726bbde commit 2855b0f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion utils/TableGen/Record.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,12 @@ const Init *BitsInit::resolveReferences(Record &R, const RecordVal *RV) const {
}

const IntInit *IntInit::get(int64_t V) {
return new IntInit(V);
typedef DenseMap<int64_t, IntInit *> Pool;
static Pool ThePool;

IntInit *&I = ThePool[V];
if (!I) I = new IntInit(V);
return I;
}

std::string IntInit::getAsString() const {
Expand Down

0 comments on commit 2855b0f

Please sign in to comment.