[AVX] Unique BitInit
authorDavid Greene <greened@obbligato.org>
Fri, 29 Jul 2011 19:07:10 +0000 (19:07 +0000)
committerDavid Greene <greened@obbligato.org>
Fri, 29 Jul 2011 19:07:10 +0000 (19:07 +0000)
Keep only two copies of BitInit: one for true and one for false.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136488 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/Record.cpp

index 0f50df69d7d4fc919cc976648e30111f0d30926e..3e0038c9e674b67f7d6dbb26138136a83308d7d9 100644 (file)
@@ -1,3 +1,4 @@
+
 //===- Record.cpp - Record implementation ---------------------------------===//
 //
 //                     The LLVM Compiler Infrastructure
@@ -448,7 +449,10 @@ const UnsetInit *UnsetInit::get() {
 }
 
 const BitInit *BitInit::get(bool V) {
-  return new BitInit(V);
+  static const BitInit True(true);
+  static const BitInit False(false);
+
+  return V ? &True : &False;
 }
 
 const BitsInit *BitsInit::get(ArrayRef<const Init *> Range) {