From 2855b0f0730b1a31aa156ea667fee79f66be4b03 Mon Sep 17 00:00:00 2001 From: David Greene Date: Fri, 29 Jul 2011 19:07:12 +0000 Subject: [PATCH 1/1] [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 --- utils/TableGen/Record.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 { -- 2.34.1