https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98782
--- Comment #11 from Tamar Christina <tnfchris at gcc dot gnu.org> --- (In reply to Jan Hubicka from comment #10) > Thanks for looking into this. I was planning to try to contact Vladimir > about the IRA behaviour here, but there was always something else to work > with higher priority. I wonder if you could possibly attach the WIP patch? > I did exchange a few emails on the subject with him, and we agreed that the best way forward would be to try to improve the heuristics instead of changing the reg allocator algorithm or handle live ranged differently. So the patches I've attached try to do just that. They're git patches where the description contains what they're trying to do. With -fno-inline-functions-called-once on AArch64 they add about a 13% improvement on exchange and no regressions anywhere else. On x86 the improvement last measured was 24% and reduces the number of spills by ~90%. The improvement on x86 is higher since AArch64 has more integer registers so we had more leeway here. > Teaching inliner to not inline this function as called once is probably just > a matter of adding a limit capping loop depth. I think that is meaningful > heuristics since inlining very large function to large loop depth is > probably not a good idea. I have patch for testing. That's great! It would be nice not needing the flag anymore. I tried to see if I could address this from a regalloc point of view but it didn't look promising... > > Do you know of other benchmarks where -fno-inline-functions-called-once help > (and ideally know why?). We plan to look into roms and tramp3d which also > regresses. Hmm no I can't say I do, we only use it for SPECCPU Intrate for Fortran benchmarks so haven't tracked the others with it.