https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127350
Bug ID: 127350
Summary: Missed optimization of multiple strcmp (p, c) == 0 for
strlen (c) == 1
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: kaelfandrew at gmail dot com
Target Milestone: ---
Created attachment 65572
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65572&action=edit
C code
https://godbolt.org/z/4cTooo5rf
With GCC trunk, src ()'s assembly has redundant check for str[1] == 0 compared
to tgt in -O2. It's not limited to X86 so it might be RTL side.
It shows up on config/alpha/alpha.cc:426
```
if (! strcmp (alpha_fprm_string, "n"))
alpha_fprm = ALPHA_FPRM_NORM;
else if (! strcmp (alpha_fprm_string, "m"))
alpha_fprm = ALPHA_FPRM_MINF;
else if (! strcmp (alpha_fprm_string, "c"))
alpha_fprm = ALPHA_FPRM_CHOP;
else if (! strcmp (alpha_fprm_string,"d"))
alpha_fprm = ALPHA_FPRM_DYN;
...
```