https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116651
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #4) > From bug 109442 comment #36 > > > I believe strlen_pass::handle_builtin_memcmp should eventually move to > > forwprop > (fold_stmt may not inspect immediate uses). That would help this particular > case. > > yes I agree. There was a few other related `== 0` optimizations I want to > add. e.g. strlen is one of them. that movement fixes comment #3 . I will go ahead and test and submit the patch for that. For comment #0, I filed PR 121710 for part of the missed optimization there; I think the loop part is what I filed as PR 121711 but I am not 100% sure.