[PATCH] D31104: [ConstantRange] Add setSizeSmallerThanOf method.

Sanjoy Das via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 17 14:26:34 PDT 2017


sanjoy added inline comments.


================
Comment at: lib/IR/ConstantRange.cpp:276
+bool
+ConstantRange::setSizeSmallerThanOf(const ConstantRange &Other) const {
+  assert(getBitWidth() == Other.getBitWidth());
----------------
sanjoy wrote:
> How about calling this `isStrictlySmallerThan`?
> 
> Also, please add a comment on why you're not simply using `getSetSize` here.  Otherwise a later "cleanup change" may break your optimization.
Actually, "smaller than" can be misinterpreted.

How about `isSizeStrictlySmallerThanOf`?

I'm mainly trying to address two things:

 - Since this is a predicate, I'd rather have its name start with `is`
 - The `set` in the beginning is redundant, IMO


https://reviews.llvm.org/D31104





More information about the llvm-commits mailing list