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

Sanjoy Das via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 10 20:10:06 PDT 2017


sanjoy added a comment.

In https://reviews.llvm.org/D31104#705089, @mzolotukhin wrote:

> Thanks for the review, Sanjoy!
>
> A follow-up question: do we want to keep `getSetSize`? It's currently only used in `SimplifyCFG.cpp`:
>
>   if (Span.getSetSize().ugt(8) || Span.isEmptySet())
>
>
> which can be replaced with something like `if (!Span.isSizeStrictlySmallerThanOf(ConstantRange(8, /*full=*/ true)) || Span.isEmptySet())`.


Won't you need `!Span.isSizeStrictlySmallerThanOf(ConstantRange(3, /*full=*/ true))`?

I'd actually propose adding a `isSizeStrictlySmallerThan` that takes an `APInt`, and calling it with `8`.

In https://reviews.llvm.org/D31104#705089, @mzolotukhin wrote:

> Thanks for the review, Sanjoy!
>
> A follow-up question: do we want to keep `getSetSize`? It's currently only used in `SimplifyCFG.cpp`:
>
>   if (Span.getSetSize().ugt(8) || Span.isEmptySet())
>
>
> which can be replaced with something like `if (!Span.isSizeStrictlySmallerThanOf(ConstantRange(8, /*full=*/ true)) || Span.isEmptySet())`.


I'd rather have a `isSizeStrictlySmallerThan` that takes a set size directly.


Repository:
  rL LLVM

https://reviews.llvm.org/D31104





More information about the llvm-commits mailing list