https://bugs.llvm.org/show_bug.cgi?id=43332

            Bug ID: 43332
           Summary: [InstCombine] Missing range check transformation
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]

int rangecheck (unsigned x) { return x - 1 <= __INT_MAX__ - 1; }

could be just (int) X > 0.

Clang
rangecheck(unsigned int):                        # @rangecheck(unsigned int)
        addl    $-1, %edi
        xorl    %eax, %eax
        cmpl    $2147483647, %edi       # imm = 0x7FFFFFFF
        setb    %al
        retq


GCC:
rangecheck(unsigned int):
        xor     eax, eax
        test    edi, edi
        setg    al
        ret

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to