[PATCH] D60536: [ConstantRange] [0, 1) divided by non-empty ranges is [0, 1).

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 24 09:26:30 PDT 2019


fhahn marked an inline comment as done.
fhahn added inline comments.


================
Comment at: llvm/lib/IR/ConstantRange.cpp:1015
   if (RHS.isFullSet())
     return getFull();
 
----------------
nikic wrote:
> This full set check looks pretty bogus to me The result of `CR1 udiv CR2` should be some subset of `[0, umax(CR1)]`, as you won't get back a larger value from a division. Your patch makes `[0, 1) udiv full-set` return `[0, 1)`, but there are also other cases where the current code is inaccurate:
> 
>     [0, 5) udiv full-set should be [0, 5)
>     [5, 10) udiv full-set should be [0, 10)
> 
> Would it be possible to just drop this check?
Not sure why the check was there in the first place! It looks like we can generalize the handling and drop it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D60536





More information about the llvm-commits mailing list