[llvm-commits] [PATCH] Make Inits FoldingSetNodes

Jakob Stoklund Olesen stoklund at 2pi.dk
Fri Jul 15 17:03:54 PDT 2011


On Jul 15, 2011, at 4:56 PM, David A. Greene wrote:

> Jakob Stoklund Olesen <stoklund at 2pi.dk> writes:
> 
>> I have a patch that interns all the RecTy objects. It reduces TableGen
>> heap usage from 24 MB to 16 MB IIRC. That is a lot in relative terms,
>> but not in absolute terms, and it didn't improve parse time by much. I
>> didn't think it was worth the churn at the time, but since you are
>> churning in the same code now, I can send you the patch if you are
>> interested.
> 
> Actually, this could help the Init effort quite a bit.  Interning RecTys
> and making them unique means I can avoid string hash/compare for all
> Inits that have a type.
> 
> So yeah, if you could commit that patch series _before_ mine, that would
> be great.  I think it best that it go in before any of my series.
> 
> Are you willing and able to commit your patch set?

Certainly. Let me clean it up a bit first ;-)

Do you need all types to be unique? I have stuff like:

+BitsRecTy *BitsRecTy::get(unsigned Sz) {
+  static BitsRecTy *Small[32];
+  if (Sz == 0 || Sz > 32)
+    return new BitsRecTy(Sz);
+  BitsRecTy *&Ty = Small[Sz - 1];
+  if (!Ty)
+    Ty = new BitsRecTy(Sz);
+  return Ty;
+}

I could easily use a DenseMap to unique everything.

/jakob




More information about the llvm-commits mailing list