[PATCH] D128011: [SimplifyLibCalls] Transform memchr(STR, C, N) to chain of ORs

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 17 08:13:42 PDT 2022


xbolva00 added a comment.

>> strchr

strchr is transformed to memchr, if possible. See test strchr_to_memchr_n_equals_len.

>> It looks like it has a hardwired limit of 8 bytes.

Very small, imho, We usually end up with one switch instruction, not a big deal. But I am fine with 32 I think.

>> An analogous optimization is applicable to other string functions ... strlen or even memcmp and strcmp

I would not overcomplicate things for know, currently just 5 lines of code. Any possible followup could create create a new helper function.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128011/new/

https://reviews.llvm.org/D128011



More information about the llvm-commits mailing list