[llvm-bugs] [Bug 48669] New: Failure to optimize modulo pattern made from division optimally

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jan 5 12:35:22 PST 2021


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

            Bug ID: 48669
           Summary: Failure to optimize modulo pattern made from division
                    optimally
           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

__INT64_TYPE__ f(__INT32_TYPE__ x, __INT32_TYPE__ y)
{
    return (__INT64_TYPE__)y - (y / x) * x;
}

This example (and most likely also a more generic form) can be optimized into
`return y % x;`. This transformation is done by GCC, but not by LLVM.

-- 
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/20210105/8e0cdbad/attachment.html>


More information about the llvm-bugs mailing list