[PATCH] D22488: [IR] Introduce a non-integral pointer type

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 28 13:53:45 PDT 2016


arsenm added inline comments.

================
Comment at: include/llvm/IR/DataLayout.h:150
@@ +149,3 @@
+  /// well-defined bitwise representation.
+  SmallVector<unsigned, 2> NonIntegralAddressSpaces;
+
----------------
sanjoy wrote:
> arsenm wrote:
> > sanjoy wrote:
> > > arsenm wrote:
> > > > Seems like it should be a SmallSet?
> > > Since this isn't going to change after creation, how about a sorted `SmallVector`?  That way we'll avoid the `isSmall` check in `isNonIntegralPointerType` and will also be able to use a binary search instead of a linear search.
> > I don't forsee this ever being larger than 3 or 4, so the linear search a SmallSet does for the small case is probably better
> > I don't forsee this ever being larger than 3 or 4, so the linear search a SmallSet does for the small case is probably better
> 
> Then why bother with a `SmallSet` at all?  If you're worried about worst-case situations where we have millions of non-integral address spaces, then a sorted vector seems better than a `SmallSet`.
> 
I suppose there's not much difference


https://reviews.llvm.org/D22488





More information about the llvm-commits mailing list