This is an archive of the discontinued LLVM Phabricator instance.

[DenseMapInfo] Add implementation for SmallVector of pointers.
AbandonedPublic

Authored by fhahn on Sep 20 2018, 9:23 AM.

Details

Reviewers
None

Diff Detail

Event Timeline

fhahn created this revision.Sep 20 2018, 9:23 AM

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 SmallVectors into these containers.

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

fhahn added a comment.Sep 20 2018, 2:23 PM

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 SmallVectors 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.

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.

Sure, might be worth profiling compile time.

fhahn abandoned this revision.Nov 13 2018, 7:30 AM

Thanks for the comments. For now, I added a custom DenseMapInfo to D49491, but I hope I can revisit this once I have more time!