[llvm-bugs] [Bug 45684] New: Failure to optimize out unary - on right operand of % when it is not -1

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Apr 26 17:49:38 PDT 2020


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

            Bug ID: 45684
           Summary: Failure to optimize out unary - on right operand of %
                    when it is not -1
           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

int f(int x, int y)
{
    __builtin_assume(y != -1);
    return x % -y;
}

Here, `x % -y` could be optimized to `x % y`, since `y != -1`. GCC does this
transformation, but LLVM does not.

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

-- 
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/6841b87c/attachment.html>


More information about the llvm-bugs mailing list