https://bugs.llvm.org/show_bug.cgi?id=47153
Bug ID: 47153
Summary: Failure to optimize out strlen that isn't used for any
other purpose than more strlen calls (which don't have
any external effect)
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(const char *a)
{
while (*a)
a += strlen(a);
}
This can be optimized to doing nothing. This transformation is done by GCC, but
not by LLVM. The same transformation can be done if `strlen(a)` is replaced by
`strspn(a, some_other_string)`, and can probably also be done for more examples
alike to this with alike functions.
--
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