https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119689
--- Comment #14 from Richard Sandiford <rsandifo at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #13)
> diff --git a/gcc/lra-remat.cc b/gcc/lra-remat.cc
> index 2f3afffcf5b..5f823193aa7 100644
> --- a/gcc/lra-remat.cc
> +++ b/gcc/lra-remat.cc
> @@ -460,7 +460,7 @@ create_cands (void)
> && dst_regno >= FIRST_PSEUDO_REGISTER
> && reg_renumber[dst_regno] < 0
> && BLOCK_FOR_INSN (insn2) == BLOCK_FOR_INSN (insn)
> - && insn2 == prev_nonnote_insn (insn))
> + && insn2 == prev_nonnote_nondebug_insn (insn))
> {
> create_cand (insn2, regno_potential_cand[src_regno].nop,
> dst_regno, insn);
>
>
> fixes the testcase.
Yeah, I'd just reached the same conclusion. Mind taking it?