https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89018
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization Status|UNCONFIRMED |NEW Last reconfirmed| |2019-01-24 CC| |rguenth at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- fold does/did some of these transforms (not for the call case). There's tail merging on GIMPLE and cross-jumping on RTL as well as ifcvt/phiopt that in theory could handle all cases. There's also code sinking that could be massaged (like I massaged it to common stores). It doesn't really fit very well anywhere though (phiopt comes closest I think, as "pre"-pass to the other transforms, emptying the middle blocks as much as possible). <bb 2> [local count: 1073741824]: if (a_2(D) >= b_3(D)) goto <bb 3>; [50.00%] else goto <bb 4>; [50.00%] <bb 3> [local count: 536870913]: iftmp.0_4 = -a_2(D); goto <bb 5>; [100.00%] <bb 4> [local count: 536870913]: iftmp.0_5 = -b_3(D); <bb 5> [local count: 1073741824]: # iftmp.0_1 = PHI <iftmp.0_4(3), iftmp.0_5(4)> return iftmp.0_1; .. <bb 2> [local count: 1073741824]: if (a_3(D) >= b_4(D)) goto <bb 3>; [50.00%] else goto <bb 4>; [50.00%] <bb 3> [local count: 536870913]: iftmp.2_7 = transform (a_3(D)); goto <bb 5>; [100.00%] <bb 4> [local count: 536870913]: iftmp.2_9 = transform (b_4(D)); <bb 5> [local count: 1073741824]: # iftmp.2_1 = PHI <iftmp.2_7(3), iftmp.2_9(4)> return iftmp.2_1;