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: [email protected]
          Reporter: [email protected]
                CC: [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to