https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63155
--- Comment #27 from Richard Biener <rguenth at gcc dot gnu.org> --- TOT now for the alternate testcase at -O1+ exhibits Time variable usr sys wall GGC ... tree CCP : 9.21 ( 64%) 0.00 ( 0%) 9.22 ( 63%) 244 kB ( 0%) ... TOTAL : 14.35 0.22 14.57 521240 kB never seen CCP take that much time. All time is spent in bitmap_set_bit called by add_ssa_edge from ssa_propagation_engine::simulate_stmt. It sets stmt UIDs in the ssa_edge_worklist. Note on that testcase CCP really does a lot (disabling CCP makes things only slower), which means the testcase is quite artificial. There are 752492 stmts at the point the SSA propagator starts to run and as out-of-SSA coalescing told us bits are spread in an unfortunate way here. Sorting the uses we walk in add_ssa_edge after gimple_uid doesn't help much. We're still processing bits like 4, 1509, 3014, 4519, 6024, 7529, 9034, ... Assigning UIDs lazily in that very function improves things (as expected), but we still have tree CCP : 3.82 ( 43%) 0.00 ( 0%) 3.83 ( 42%) 244 kB ( 0%) after that. I'll dig a bit further later.