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

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 28 13:50:58 PDT 2016


sanjoy added inline comments.

================
Comment at: include/llvm/IR/DataLayout.h:150
@@ +149,3 @@
+  /// well-defined bitwise representation.
+  SmallVector<unsigned, 2> NonIntegralAddressSpaces;
+
----------------
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`.



https://reviews.llvm.org/D22488





More information about the llvm-commits mailing list