https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108459
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I think that ought to be fine. There is if (single_nonrect == -1 || (loop->m1 && TREE_CODE (loop->m1) != INTEGER_CST) || (loop->m2 && TREE_CODE (loop->m2) != INTEGER_CST) || TREE_CODE (loop->n1) != INTEGER_CST || TREE_CODE (loop->n2) != INTEGER_CST || TREE_CODE (loop->step) != INTEGER_CST) { count = NULL_TREE; continue; } some lines above that, after all, it is also using fold_binary rather than fold_build2 etc. All that code is there to compute the constant number of iterations and other helper values for non-rectangular loops with all constant expressions.