https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108086
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:d49b2a3a1dbbe3ac9ae134bc5742be7fdb417d32 commit r13-4723-gd49b2a3a1dbbe3ac9ae134bc5742be7fdb417d32 Author: Richard Biener <rguent...@suse.de> Date: Thu Dec 15 13:42:16 2022 +0100 middle-end/108086 - avoid quadraticness in copy_edges_for_bb For the testcase in PR108086 it's visible that we split blocks multiple times when inlining and that causes us to adjust the block tail stmt BBs multiple times, once for each split. The fix is to walk backwards and split from the tail instead. For a reduced testcase this improves compile-time at -O by 4%. PR middle-end/108086 * tree-inline.cc (copy_edges_for_bb): Walk stmts backwards for splitting the block to avoid quadratic behavior with setting stmts BB on multliple splits.