https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77416
--- Comment #8 from Vladimir Makarov <vmakarov at gcc dot gnu.org> --- Sorry for delay with the answer. I had a long vacation. LRA remat sub-pass did not check relation between the hard coded insn registers. It checked only relations between operand registers and other operands and hard coded insn registers. The attached patch should solve the problem. If it works for you. I'll commit it on the next week.