https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114230
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Summary|Missed optimization of loop |Missed optimization of loop |deletion: a=0||a |deletion: `a!=0` CC| |pinskia at gcc dot gnu.org Keywords| |missed-optimization Severity|normal |enhancement Last reconfirmed| |2024-03-05 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Confirmed. we have: ``` <bb 3> [local count: 1063004408]: # i_11 = PHI <i_8(5), 0(2)> # a_lsm.4_13 = PHI <_3(5), a_lsm.4_5(2)> _2 = a_lsm.4_13 != 0; _3 = (int) _2; i_8 = i_11 + 1; if (i_8 != 100000) goto <bb 5>; [98.99%] else goto <bb 4>; [1.01%] <bb 5> [local count: 1052266995]: goto <bb 3>; [100.00%] ``` Which sccp does not handle `(int)a != 0` currently. It does handle `a|=b;`, `a^=b;`, and `a&=b;` though.