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: [email protected]
Reporter: [email protected]
CC: [email protected]
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 <[email protected]> ---
*** 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
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs