[llvm-bugs] [Bug 51550] New: LoopIdiom does not produce memcpy/memset with runtime checks if pointers may alias

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 19 14:38:57 PDT 2021


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

            Bug ID: 51550
           Summary: LoopIdiom does not produce memcpy/memset with runtime
                    checks if pointers may alias
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: david.bolvansky at gmail.com
                CC: llvm-bugs at lists.llvm.org

typedef __SIZE_TYPE__ size_t;

void idiom_memcpy_aliasing(unsigned char * dst, size_t d_len, unsigned char
*src)
{
  // no restrict, possible aliasing
  unsigned char *d_end = dst + d_len;
  // icc seems to produce memcpy when alias checks are OK and d_len j < 96,
jumps to trivial copy loop otherwise.
  while (dst < d_end)
    *dst++ = *src++;
}

ICC -O2+ is able to do this kind of transformation.

https://godbolt.org/z/eK1P4YjMf

-- 
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/20210819/e37f1f96/attachment.html>


More information about the llvm-bugs mailing list