https://bugs.llvm.org/show_bug.cgi?id=46490
Bug ID: 46490
Summary: Failure to optimize sprintf of single string to strcpy
instead of using strlen+strcpy
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: RESOLVED
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Status: RESOLVED
Resolution: DUPLICATE
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]> ---
Oops, looks like this somehow got duplicated. Marked as duplicate of
https://bugs.llvm.org/show_bug.cgi?id=46489
*** This bug has been marked as a duplicate of bug 46489 ***
--
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