https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94274
--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> --- Detecting common beginnings / endings in branches is something gcc does very seldom. Even at -Os, for if(cond)f(b);else f(c); we need to wait until rtl-optimizations to get a single call to f. (of course the reverse transformation of duplicating a statement that was after the branches into them, if it simplifies, is nice as well, and they can conflict) I don't know if handling one such very specific case (binary operations with a common argument) separately is a good idea when we don't even handle unary operations.