https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113575
--- Comment #12 from Robin Dapp <rdapp at gcc dot gnu.org> --- Created attachment 57209 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57209&action=edit Tentative I tested the attached "fix". On my machine with 13.2 host compiler it reduced the build time for insn-opinit.cc from > 4 mins to < 2 mins and the memory usage from >1G to 600ish M. I didn't observe 3.5G before, though. For now I just went with an arbitrary threshold of 5000 patterns and splitting into 10 functions. After testing on x86 and aarch64 I realized that both have <3000 patterns so right now it would only split riscv's init function. Or rather the other way, i.e. splitting into fixed-size chunks (of 1000) instead?