Re: [PATCH v2] tree-optimization/95821 - Convert strlen + strchr to memchr

2022-07-07 Thread Noah Goldstein via Gcc-patches
On Tue, Jun 21, 2022 at 11:13 AM Noah Goldstein wrote: > > On Tue, Jun 21, 2022 at 5:01 AM Jakub Jelinek wrote: > > > > On Mon, Jun 20, 2022 at 02:42:20PM -0700, Noah Goldstein wrote: > > > This patch allows for strchr(x, c) to the replace with memchr(x, c, > > > strlen(x) + 1) if strlen(x) has a

Re: [PATCH v2] tree-optimization/95821 - Convert strlen + strchr to memchr

2022-06-21 Thread Noah Goldstein via Gcc-patches
On Tue, Jun 21, 2022 at 5:01 AM Jakub Jelinek wrote: > > On Mon, Jun 20, 2022 at 02:42:20PM -0700, Noah Goldstein wrote: > > This patch allows for strchr(x, c) to the replace with memchr(x, c, > > strlen(x) + 1) if strlen(x) has already been computed earlier in the > > tree. > > > > Handles PR9582

Re: [PATCH v2] tree-optimization/95821 - Convert strlen + strchr to memchr

2022-06-21 Thread Jakub Jelinek via Gcc-patches
On Mon, Jun 20, 2022 at 02:42:20PM -0700, Noah Goldstein wrote: > This patch allows for strchr(x, c) to the replace with memchr(x, c, > strlen(x) + 1) if strlen(x) has already been computed earlier in the > tree. > > Handles PR95821: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95821 > > Since me

[PATCH v2] tree-optimization/95821 - Convert strlen + strchr to memchr

2022-06-20 Thread Noah Goldstein via Gcc-patches
This patch allows for strchr(x, c) to the replace with memchr(x, c, strlen(x) + 1) if strlen(x) has already been computed earlier in the tree. Handles PR95821: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95821 Since memchr doesn't need to re-find the null terminator it is faster than strchr. bo