[PATCH] D88409: [SVE] Make ElementCount and TypeSize use a new PolySize class

Vineet Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 5 17:34:02 PDT 2020


vkmr added inline comments.


================
Comment at: llvm/include/llvm/Support/TypeSize.h:45
   }
 
   /// Counting predicates.
----------------
ctetreau wrote:
> vkmr wrote:
> > It might be useful to add an explicit `getNone()` (or `getZero()`) function that simply returns `{0, false}` value. For instance, there are places using `Optional<ElementCount>`for VF  (and `Optional<unsigned>` where VF is not yet ported to `ElementCount`) and use `None` to represent VectorizationFailure.  We already have `isZero()` and `isNonZero()` functions so a Zero getter should not be out of tune.
> Bikeshedding: Maybe it should be named something like `getNull()` or `getInvalid()`? You propose using `getZero()` instead of having an `Optional<ElementCount>`. I think this usage is fine, but we should be clear that the thing is a garbage value, not zero in the mathematical sense. This lets us make the garbage value be something different in the future if there ends up being a better option.
Good point @ctetreau! I am not too keen on one name over other, but if I have to, my vote is for `getNull()`; I feel it best conveys the idea. 


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88409/new/

https://reviews.llvm.org/D88409



More information about the llvm-commits mailing list