[llvm-dev] Signed or unsigned EQ/NEQ

David Chisnall via llvm-dev llvm-dev at lists.llvm.org
Sat Nov 18 02:22:53 PST 2017


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 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



More information about the llvm-dev mailing list