https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109035
--- Comment #3 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
(In reply to chenglulu from comment #2)
> I think this is most likely caused by the implementation of the public code.
Agree, so I filled the component as rtl-optimization.
I tracked a (non root) cause to the line 1944 in ira-costs.cc:
if (i >= first_moveable_pseudo && i < last_moveable_pseudo)
i_mem_cost = 0;
else if (equiv_savings < 0)
i_mem_cost = -equiv_savings;
else if (equiv_savings > 0)
{
i_mem_cost = 0; // <====== HERE
for (k = cost_classes_ptr->num - 1; k >= 0; k--)
i_costs[k] += equiv_savings;
}
I don't really understand why we should prefer the memory if there is a
REG_EQUIV note, nor why this does not happen with -fPIE.