[PATCH] D128011: [SimplifyLibCalls] Transform memchr(STR, C, N) to chain of ORs
Martin Sebor via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 22 12:50:37 PDT 2022
msebor added a comment.
Something like this seems to do the right thing (`s` is a container like `StringRef`):
int last = 0;
int n = std::count_if (s.begin(), s.end(),
[&last](char c) {
bool ret = (unsigned char)c > (unsigned char)last + 1;
last = c;
return ret; });
(It would be a bit more involved if it had to handle different charsets between the host and the target.)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D128011/new/
https://reviews.llvm.org/D128011
More information about the llvm-commits
mailing list