[AVX] Make IntInit Unique

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
This commit is contained in:
David Greene 2011-07-29 19:07:12 +00:00
parent 726bbde3c4
commit 2855b0f073

View File

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