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: unassignedb...@nondot.org
          Reporter: david.bolvan...@gmail.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to