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

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


sanjoy accepted this revision.
sanjoy added a comment.
This revision is now accepted and ready to land.

Nice catch!  LGTM.



================
Comment at: include/llvm/IR/ConstantRange.h:187
 
+  bool setSizeSmallerThanOf(const ConstantRange &CR) const;
+
----------------
Comment?



================
Comment at: lib/IR/ConstantRange.cpp:276
+bool
+ConstantRange::setSizeSmallerThanOf(const ConstantRange &Other) const {
+  assert(getBitWidth() == Other.getBitWidth());
----------------
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.


https://reviews.llvm.org/D31104





More information about the llvm-commits mailing list