https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79119
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- So a couple of things need to happen really: optimized now: if (p_10 < q_12) goto <bb 3>; [50.00%] else goto <bb 4>; [50.00%] <bb 3> [local count: 536870913]: _3 = _22 - _21; _4 = _3 /[ex] 4; iftmp.0_14 = (long unsigned int) _4; goto <bb 5>; [100.00%] <bb 4> [local count: 536870913]: _5 = _21 - _22; _6 = _5 /[ex] 4; iftmp.0_13 = (long unsigned int) _6; <bb 5> [local count: 1073741824]: # iftmp.0_7 = PHI <iftmp.0_14(3), iftmp.0_13(4)> I have a patch which is able to move the cast out of the PHI (will be posting it today or tomorrow). The next thing is we need to move the /[ext] 4 out of the PHI, I have not extended PHIOPT to do that just yet (just extended it to handle unary operations though). And then we have to see the abs but with _22/_21 being unrelated to p_10/q_12 except with a cast, it might be hard. I am looking into a patch for the case where if _22/_21 was in the conditional.