[llvm-bugs] [Bug 47858] New: Missed simplification with not

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Oct 15 05:56:00 PDT 2020


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

            Bug ID: 47858
           Summary: Missed simplification with not
           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

void foo(void);                                                                 

void s(unsigned a, unsigned b)                                                  
{                                                                               
        unsigned x = ~b;                                                        

        if (x > 0 && x > a)                                                     
                foo();                                                          
}

Clang -O3:

s(unsigned int, unsigned int):                                 # @s(unsigned
int, unsigned int)
        cmp     esi, -1
        je      .LBB0_2
        not     esi
        cmp     esi, edi
        jbe     .LBB0_2
        jmp     foo()                         # TAILCALL
.LBB0_2:
        ret


GCC -O3:
s(unsigned int, unsigned int):
        not     esi
        cmp     esi, edi
        ja      .L4
        ret
.L4:
        jmp     foo()

-- 
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/20201015/1e7d856d/attachment.html>


More information about the llvm-bugs mailing list