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

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 10 13:29:48 PDT 2019


nikic added inline comments.


================
Comment at: llvm/lib/IR/ConstantRange.cpp:1015
   if (RHS.isFullSet())
     return getFull();
 
----------------
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?


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