https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95264
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- We're then inlining some more costing another ~5GB ontop of the early optimization memory use of ~5GB (might be other IPA transforms than inlining as well). The big function is meanwhile 2 million basic blocks... update-SSA and friends are no fun here (the function with 2 million BBs is eval_orthob). Ah, you use [[gnu::flatten]] on that - so isn't it just what you asked for? I wonder if Clang implements that at all. Note the issue with -fvar-tracking* and -g and large functions is known...