[llvm-dev] Wrong Range of SCEV for URem

Tingyuan LIANG via llvm-dev llvm-dev at lists.llvm.org
Wed Jun 12 09:45:11 PDT 2019


Dear all,

    Hi! I noticed an interesting situation when using getUnsignedRange and getSignedRange of SCEV for URem instruction.
    Here is an example with 2 IR instructions:

         %rem.lhs.trunc = trunc i32 %i15.082 to i8 -->  getUnsignedRange --> [1,50)
         %rem81 = urem i8 %rem.lhs.trunc, 3  -->  getUnsignedRange --> [-47,50)

    The problems are:
        1) From my perspective, the getUnsignedRange() function should return non-negative range but it seems not so in the example. Is there anything wrong?
        2) The range of the IR %rem81 should be [0,3), considering the equation: X%3 < 3?

    Thanks in advance for your time and suggestions!


Best regards,
------------------------------------------
Tingyuan LIANG
MPhil Student
Department of Electronic and Computer Engineering
The Hong Kong University of Science and Technology
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190612/1e25559f/attachment.html>


More information about the llvm-dev mailing list