https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117091
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pheeck at gcc dot gnu.org --- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- The issue is a bad data-structure: auto_vec<int, m_max_case_bit_tests> dest_bbs; for (unsigned i = start; i <= end; i++) { simple_cluster *sc = static_cast<simple_cluster *> (clusters[i]); /* m_max_case_bit_tests is very small integer, thus the operation is constant. */ if (!dest_bbs.contains (sc->m_case_bb->index)) it uses vec::contains which is a linear search. Pushing all BBs, sorting and then counting non-dups would be one speedup, another would be to use a bitmap (with tree view) and a counter. I wouldn't start with disabling this at -O0 and -O1 ;)