[PATCH] D52312: [DenseMapInfo] Add implementation for SmallVector of pointers.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 20 14:26:20 PDT 2018


fhahn added a comment.

In https://reviews.llvm.org/D52312#1240764, @dexonsmith wrote:

> I'm concerned about propagating this pattern.  `DenseSet`, like `DenseMap`, is tuned for small keys and values.  `SmallVector<void*,4>` is not exactly small, at 48B.  And this patch makes it easy to throw much larger `SmallVector`s into these containers.


Agreed, having this generally available makes it more likely to be misused unfortunately. If we end up going with SmallVector, we should definitely limit the number of elements.

> I wonder, could these be replaced by `TinyPtrVector`?  They're only 8B.

Interesting, I'll have a look. My only worry with this is that in the LSR and SLP use cases, it is very likely that the vector contains more than 1 element.


https://reviews.llvm.org/D52312





More information about the llvm-commits mailing list