https://bugs.llvm.org/show_bug.cgi?id=46489
Bug ID: 46489
Summary: Failure to optimize sprintf of single string to strcpy
instead of using strlen+strcpy
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedb...@nondot.org
Reporter: gabrav...@gmail.com
CC: llvm-bugs@lists.llvm.org
void f(char *p, const char *s)
{
sprintf(p, "%s", s);
}
This can be optimized to `strcpy(p, s)`. This transformation is done by GCC.
but not by LLVM, which instead transforms it to `memcpy(p, s, strlen(s) + 1)`
--- Comment #1 from Gabriel Ravier <gabrav...@gmail.com> ---
*** Bug 46490 has been marked as a duplicate of this bug. ***
--
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