[llvm-commits] [PATCH 06/20] [AVX] Unique UnsetInit

David Greene dag at cray.com
Tue Jul 19 13:11:41 PDT 2011


Keep only one UnsetInit around.
---
 utils/TableGen/Record.cpp |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git oldutils/TableGen/Record.cpp newutils/TableGen/Record.cpp
index 3339a22..72b1f5f 100644
--- oldutils/TableGen/Record.cpp
+++ newutils/TableGen/Record.cpp
@@ -397,7 +397,11 @@ RecTy *llvm::resolveTypes(RecTy *T1, RecTy *T2) {
 void Init::dump() const { return print(errs()); }
 
 const UnsetInit *UnsetInit::get() {
-  return new UnsetInit;
+  static const UnsetInit *TheInit = 0;
+  if (TheInit == 0)
+    TheInit = new UnsetInit();
+
+  return TheInit;
 }
 
 const BitInit *BitInit::get(bool V) {
-- 
1.7.6




More information about the llvm-commits mailing list