https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119340
--- Comment #7 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
Well, I think this is just PR116550. Before LRA:
(jump_insn 930 383 1043 73 (parallel [
(set (pc)
(if_then_else (ne (reg:DI 592 [424])
(const_int 1 [0x1]))
(label_ref:DI 1081)
(pc)))
(set (reg:DI 592 [424])
(plus:DI (reg:DI 592 [424])
(const_int -1 [0xffffffffffffffff])))
(clobber (scratch:CC))
(clobber (scratch:DI))
]) "pr119340.i":37:16 874 {bdnz_di}
(int_list:REG_BR_PROB 941032196 (nil))
-> 1081)
Then LRA substitutes scratch with pesudos:
Creating newreg=635
Removing SCRATCH to p635 in insn #930 (nop 3)
Creating newreg=636
Removing SCRATCH to p636 in insn #930 (nop 4)
rescanning insn with uid = 930.
And then LRA tries to spill 635:
(jump_insn 930 383 1043 79 (parallel [
(set (pc)
(if_then_else (ne (reg:DI 97 ctr [424])
(const_int 1 [0x1]))
(label_ref:DI 1081)
(pc)))
(set (reg:DI 97 ctr [424])
(plus:DI (reg:DI 97 ctr [424])
(const_int -1 [0xffffffffffffffff])))
(clobber (mem/c:CC (plus:DI (reg/f:DI 110 sfp)
(const_int 108 [0x6c])) [6 %sfp+108 S4 A32]))
(clobber (scratch:DI))
]) "pr119340.i":37:16 874 {bdnz_di}
(int_list:REG_BR_PROB 941032196 (nil))
-> 1081)
And per PR116550 comment 4 doing so is not valid.
Thus the fix seems backporting r15-4406?