[llvm-bugs] [Bug 45686] New: Failure to combine assumptions on range of value of variable

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Apr 26 18:39:51 PDT 2020


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

            Bug ID: 45686
           Summary: Failure to combine assumptions on range of value 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 foo(int a, int b, bool c)
{
    __builtin_assume(a < 234);
    __builtin_assume(b > 789);
    int d = (c ? a : b);
    if (d >= 234 && d <= 789)
        g();
}

GCC optimizes the entire function out, LLVM does not. Most likely we'd want
LLVM to combine the assumptions on `a` and `b` in such a way that `d >= 234 &&
d <= 789` would be considered always false afterwards

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

-- 
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/29cdeabe/attachment.html>


More information about the llvm-bugs mailing list