[llvm-commits] [PATCH] PR12156, SmallPtrMap

Jakob Stoklund Olesen stoklund at 2pi.dk
Tue Mar 13 09:59:10 PDT 2012


On Mar 13, 2012, at 5:47 AM, Stepan Dyatkovskiy <stpworld at narod.ru> wrote:

> Hi all. Please find in attachment SmallPtrMap implementation for review.
> It works exactly like a SmallPtrSet, but arrays of pointers was replaced with arrays of pair<ptr,item>.
> I also implemented the unit tests for new class it is also included into patch.

Hi Stepan,

Sorry I missed the original PR, or I would have commented earlier.

I know Daniel asked for this, but why implement a SmallPtrMap instead of a SmallMap? The SmallPtrSet is limited to pointers because it can cast to void* and avoid a lot of the template code duplication. This class can't do that because it still has the StoredTy template argument.

It also irks me to see most of DenseMap.h duplicated. Couldn't you just use a DenseMap member for the 'big' mode?

Thanks for working on this!

/jakob




More information about the llvm-commits mailing list