https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82405
--- Comment #11 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Thinking about this some more, this is a not a hoisting problem but a sinking problem. basically we have: int f(void); int h(void); int g(int a) { if (a) return f() + 10; return h() + 10; } Which should be converted into: int g1(int a) { int t; if (a) t = f(); else t = h(); return t + 10; } We handle hoisting just fine; just not sinking common. So we don't need reassoc in the original testcase if we do sinking.