[llvm-bugs] [Bug 45687] New: Failure to optimize away abs check based on known range of variable

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Apr 26 19:22:32 PDT 2020


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

            Bug ID: 45687
           Summary: Failure to optimize away abs check based on known
                    range of variable
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: gabravier at gmail.com
                CC: llvm-bugs at lists.llvm.org

void g();

void f(int i)
{
    __builtin_assume(i >= -1 && i <= 1);

    if (abs(i) > 1)
        g();
}

This can all be optimized out. GCC does this transformation, LLVM does not.

Comparison here : https://godbolt.org/z/cLcicG

-- 
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/20200427/7c84f241/attachment.html>


More information about the llvm-bugs mailing list