https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93055
--- Comment #10 from Vladimir Makarov <vmakarov at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #9) > Vlad, any thoughts on this? A pseudo in the loop happens to be spilled. So the pseudo is changed onto its equivalence which is an invariant to the loop. It is hard to say why the pseudo was spilled. I can only see that IRA forms a lot of regions for the whole function. IRA takes a lot of consideration like cost of pseudo usage in loop and cost of moving (and storing/loading) it on the region border. The costs are based on static predictions which can be inaccurate. I think usage of profiling could remove the spill. I could look why costs are such that they results in spilling the pseudo. But it might take a lot of time. I am not sure that fixing costs for this case would not worsen other benchmarks and checking this could take some time too. I think an invariant motion after the reload is a better solution which could improves LRA decisions as LRA (unlike IRA) does not work with and does not understand loops.