An aarch64 toolchain built with --enable-default-pie fails gcc.target/aarch64/sme/nonlocal_goto_[123].c because the register allocator ends up resetting equivalences, so it concludes it needs to preserve a rematerializable function invariant across a call instead of rematerializing it.
Allow function invariant equivalences to remain when the other circumstances that may require their removal don't apply. Tested on aarch64-linux-gnu with --enable-default-pie --enable-host-pie, but I note this is not a complete fix for the problem, and I'm not confident it's safe. Does this look ok to install? for gcc/ChangeLog * ira.cc (setup_reg_equiv): Retain function invariant equivalences. --- gcc/ira.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/ira.cc b/gcc/ira.cc index 4eebc9c4c50fb..79cf9a413cfb2 100644 --- a/gcc/ira.cc +++ b/gcc/ira.cc @@ -4278,6 +4278,9 @@ setup_reg_equiv (void) continue; } } + else if (function_invariant_p (x)) + /* Leave ira_reg_equiv alone. */ + continue; } ira_reg_equiv[i].defined_p = false; ira_reg_equiv[i].caller_save_p = false; -- Alexandre Oliva, happy hacker https://blog.lx.oliva.nom.br/ Free Software Activist FSFLA co-founder GNU Toolchain Engineer More tolerance and less prejudice are key for inclusion and diversity. Excluding neuro-others for not behaving ""normal"" is *not* inclusive!