https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104680
--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> --- At least right now the analyzer might be too late for this though, no? There could be various optimizations before it that make it hard to figure out what was actually user code and what is something else. On the other side, doing this in the FEs would handle only the most trivial cases, any time there would be some function call or inline asm or whatever else could have possibly changed any values in the expressions, we'd need to punt. So, at least having a SSA form so that we can find out what is the same value and what is (possibly) different would be helpful, likely with at least a forwprop.