https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44563
--- Comment #23 from Richard Biener <rguenth at gcc dot gnu.org> --- Funnily apart from the IPA inline summary updating issue the next important time-hog is basic-block splitting we do for inlining a call. This is because split_block moves the tail of the block to a new one (and we process inlines from BB head to BB start). And thus we hit gimple_set_bb () quite hard (quadratic in the number of calls in main() which is composed of a single BB). So in theory it's better to work backwards from the BB - but that doesn't play well with catching all BBs in gimple_expand_calls_inline and its caller. We are talking about 8% of compile-time spent in gimple_set_bb here (according to callgrind). It's bad that splitting blocks is O(n) (but that stmt -> bb pointer saves us in other places). If we'd know that we perform multiple inlinings in a block we could use a special "split block" function that splits the block in multiple places at once, avoiding the quadraticness seen here. Basically first split all calls that we want to inline to separate blocks and then do the actual inlining run.