(original) (raw)

Can you figure out the induction variable range?

If it is within \[0, signed-max\], then both signed and unsigned operations produce the same result, no?


On Sat, Nov 18, 2017 at 12:22 PM, David Chisnall via llvm-dev <llvm-dev@lists.llvm.org> wrote:
On 17 Nov 2017, at 21:11, Dounia Khaldi via llvm-dev <llvm-dev@lists.llvm.org> wrote:
\>
\> The problem is that CmpInst::ICMP\_EQ and CmpInst::ICMP\_NE are neither signed nor unsigned in LLVM. Also, I did not find a way to find out if the integer operands of the CmpInst are signed or unsigned. Apparently, LLVM does not distinguish in its type system between signed and unsigned variables. So, I am not able to generate the appropriate signed or unsigned ICMP\_(S|U)LT or ICMP\_(S|U)GT.

In what way would you expect a signed and unsigned integer to differ in equality comparison? Two integers are equal if they have the same bit pattern, they are not equal if they do not. If you want help in constructing a signed and unsigned notion of equality then you’ll first have to define what you want it to mean, or you are unlikely to find anyone able to help.

David

\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
LLVM Developers mailing list
llvm-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev