https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95252
--- Comment #3 from Jim Wilson <wilson at gcc dot gnu.org> --- I tried both. Turning off register naming works. It gives a code size decrease of about 0.003% for the libraries I looked at which can be ignored. This probably also reduces performance; I didn't check that. I think it would be better to leave register naming on and define the PREFERRED_RENAME_CLASS hook. Adding uses to the gpr_save pattern also works for the testcase. I just added uses for all of the saved regs. We shouldn't need an exact list, because there is little or no code before the prologue, and the prologues are added late. An exact list would be cleaner if you want to try to do that. I also needed to fix riscv_remove_unneeded_save_restore_calls to ignore the prologue_matched insn when checking for USEs to avoid gcc testsuite regressions. I now have 3 g++ testsuite regressions I haven't looked at yet. FAIL: g++.dg/torture/stackalign/throw-1.C -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions -fpic execution test FAIL: g++.dg/torture/stackalign/throw-2.C -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test FAIL: g++.dg/torture/stackalign/throw-2.C -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions -fpic execution test