https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96245
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2020-07-20 CC| |marxin at gcc dot gnu.org Keywords| |missed-optimization Ever confirmed|0 |1 Status|UNCONFIRMED |NEW --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- switch-conversion(?), it does look like a very special case. Similar: int y; void f(int x) { switch (x) { case 0: y = 0; break; case 1: y = 1; break; ... converting to if (...) y = x; or more general to x + CST. The store commoning patch should in this case sink this to y = PHI<...> where switch-conversion would convert the PHI<...>. For the putchar case there's nothing "commoming" the call (the same code doing the store sinking could also sink calls if we want that). Not sure if switch-conversion itself would want to do this (profitability increases if we can eliminate the PHI<> by arithmetics).