[llvm-bugs] [Bug 43332] New: [InstCombine] Missing range check transformation

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Sep 16 12:01:55 PDT 2019


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: unassignedbugs at nondot.org
          Reporter: david.bolvansky at gmail.com
                CC: llvm-bugs at lists.llvm.org

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190916/9bee069b/attachment.html>


More information about the llvm-bugs mailing list