[llvm-dev] Signed or unsigned EQ/NEQ

Nikodemus Siivola via llvm-dev llvm-dev at lists.llvm.org
Sat Nov 18 03:06:18 PST 2017

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 at lists.llvm.org> wrote:

> On 17 Nov 2017, at 21:11, Dounia Khaldi via llvm-dev <
> llvm-dev at 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
> 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 at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171118/9786162c/attachment.html>

More information about the llvm-dev mailing list