https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100393
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- I guess that's already done, so it has to be fixed in other ways, like by keeping the partial sum when decreasing the size in for (unsigned j = 0; j < i; j++) { if (min[j].m_count + 1 < min[i].m_count && can_be_handled (clusters, j, i - 1)) min[i] = min_cluster_item (min[j].m_count + 1, j, INT_MAX); } maybe "simply" binary search j in [0, i-1] rather than doing a linear search here.