From: David Greene Date: Fri, 29 Jul 2011 19:07:12 +0000 (+0000) Subject: [AVX] Make IntInit Unique X-Git-Tag: android-x86-6.0-r1~928^2~2732 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=2855b0f0730b1a31aa156ea667fee79f66be4b03;p=android-x86%2Fexternal-llvm.git [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 --- diff --git a/utils/TableGen/Record.cpp b/utils/TableGen/Record.cpp index 77c0d1a491d..54edfe5ea8f 100644 --- a/utils/TableGen/Record.cpp +++ b/utils/TableGen/Record.cpp @@ -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 Pool; + static Pool ThePool; + + IntInit *&I = ThePool[V]; + if (!I) I = new IntInit(V); + return I; } std::string IntInit::getAsString() const {