https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69564
--- Comment #21 from Patrick Palka <ppalka at gcc dot gnu.org> --- To be clear, given the loop for (int i = 0; i < M; i++) { ... } The fold_build3 in question was transforming if (i < M) fallthrough; else goto exit; to if (i >= M) goto exit; else fallthrough; The C FE emits if (i < M) goto body; else goto L; L: I would guess r217669 introduced the regression. Before this commit the two arms of the COND_EXPR would be GOTO_EXPRs and so during folding tree_swap_operands_p would return false. After this commit, the true arm is an empty statement which is TREE_CONSTANT and so during folding tree_swap_operands_p returns true. The tree dumps do not seem to diverge significantly with and without the above patch. The only difference throughout is the inversion of the branches.