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

            Bug ID: 49057
           Summary: Failure to optimize out redundant overflow check
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedb...@nondot.org
          Reporter: gabrav...@gmail.com
                CC: llvm-bugs@lists.llvm.org

unsigned foo(unsigned a, unsigned b)
{
    unsigned sum = a + b;
    if (sum < a)
        abort();
    if (sum < b)
        abort();
    return sum;
}

The second `if` condition can be optimized out. This transformation is done by
GCC, but not by LLVM.

Godbolt comparison: https://godbolt.org/z/KeGWx8
alive2 check: https://alive2.llvm.org/ce/z/5hk_x7

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

Reply via email to