https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121852

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
--- gcc/rtlanal.cc.jj   2025-08-23 15:00:04.737781678 +0200
+++ gcc/rtlanal.cc      2025-12-09 19:11:33.519215100 +0100
@@ -1557,7 +1557,10 @@ single_set_2 (const rtx_insn *insn, cons
                 sets are found in the insn, we check them.  */
              if (!set_verified)
                {
-                 if (find_reg_note (insn, REG_UNUSED, SET_DEST (set))
+                 if ((df ? (REG_P (SET_DEST (set))
+                            && REGNO (SET_DEST (set)) < df->regs_inited
+                            && DF_REG_USE_COUNT (REGNO (SET_DEST (set))) == 0)
+                      : !!find_reg_note (insn, REG_UNUSED, SET_DEST (set)))
                      && !side_effects_p (set))
                    set = NULL;
                  else
@@ -1565,7 +1568,11 @@ single_set_2 (const rtx_insn *insn, cons
                }
              if (!set)
                set = sub, set_verified = 0;
-             else if (!find_reg_note (insn, REG_UNUSED, SET_DEST (sub))
+             else if (!(df ? (REG_P (SET_DEST (sub))
+                              && REGNO (SET_DEST (sub)) < df->regs_inited
+                              && (DF_REG_USE_COUNT (REGNO (SET_DEST (sub)))
+                                  == 0))
+                        : !!find_reg_note (insn, REG_UNUSED, SET_DEST (sub)))
                       || side_effects_p (sub))
                return NULL_RTX;
              break;
fixes this.

Reply via email to