https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111215
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- So there might be two ways of fixing this: <bb 2> [local count: 1073741824]: if (a_3(D) != 0) goto <bb 3>; [50.00%] else goto <bb 4>; [50.00%] <bb 3> [local count: 536870912]: if (b_2(D) != 0) goto <bb 6>; [50.00%] else goto <bb 5>; [50.00%] <bb 4> [local count: 536870912]: if (b_2(D) != 0) goto <bb 6>; [50.00%] else goto <bb 5>; [50.00%] <bb 5> [local count: 536870912]: ... <bb 6> [local count: 536870912]: # iftmp.0_21 = PHI <1(3), 0(4)> So we could swap this if around slighlty if (b_2(D) != 0) goto L1; else goto L2; L1: if (a_3(D) != 0) goto L3; else goto L4; L3: goto L4; L4: iftmp.0_21 = PHI <1(3), 0(4)> L1: goto bb5; Implementing that will take some time. But --param=logical-op-non-short-circuit=1 is enough to fix the testcase so that is what I am going to use here. Will file another bug about the above case.