https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104985
--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I think once gen_reg_rtx is called, we no longer overwrite regno_reg_rtx[regno] but just modify it in place to change mode (except that we throw it away at the end of RTL passes for each function), so I think all 3 patches should be safe.