https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106499
--- Comment #12 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Tomasz Kłoczko from comment #11) > (In reply to Andrew Pinski from comment #10) > > The flatten attribute is designed to override all heuristics in the compiler > > that is designed to not cause the gignatic memory usage and compile time. > > Basically you told the compiler to ignore those. > > Now I'm a bit confused because in this case looks like use flatten attribute > caused high memory usage. > Does it mean that (generally) flatten should not be used at the same time > with inline? The flatten attribute combined with LTO causes the high memory usage. Flatten means inline everything into that function and ignore heuristics that might otherwise block the inlining. Basically this means flatten should not be used combined with LTO. With LTO you could just allow the heuristics do its job and back off as needed.