[llvm-bugs] [Bug 52050] New: Failure to optimize null check after memmove

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Oct 3 04:56:29 PDT 2021


            Bug ID: 52050
           Summary: Failure to optimize null check after memmove
           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 copy(int *dest, int *src, size_t nbytes) {
  memmove(dest, src, nbytes);
  if (src != NULL)
    return *src;
  return 0;

The `if (src != NULL)` check can be optimized to `true`. This optimization 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/20211003/4d2dd4a1/attachment.html>

More information about the llvm-bugs mailing list