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

--- Comment #3 from Bernd Edlinger <edlinger at gcc dot gnu.org> ---
because a different pattern is choosen for this insn
the reg-note is overwritten here:

         Choosing alt 2 in insn 48:  (0) l  (1) l  (2) lL {*thumb1_addsi3}
      Creating newreg=129, assigning class LO_REGS to r129
   48: sfp:SI=r7:SI+r129:SI
      REG_EQUAL r7:SI+r129:SI
    Inserting insn reload before:
   82: r129:SI=0xfffffffffffffff0

but it should be:

         Choosing alt 2 in insn 48:  (0) l  (1) l  (2) lL {*thumb1_addsi3}
      Creating newreg=129, assigning class LO_REGS to r129
   48: sfp:SI=r7:SI+r129:SI
      REG_EQUAL r7:SI-0x10
    Inserting insn reload before:
   82: r129:SI=0xfffffffffffffff0

and in the next pass this insn is removed because the reg-note
is no longer found.


The reason is the alias between the reg-note and the SET_SRC.
So this would be a more conservative fix:


Index: lra-eliminations.c
===================================================================
--- lra-eliminations.c  (revision 240437)
+++ lra-eliminations.c  (working copy)
@@ -981,7 +981,7 @@ eliminate_regs_in_insn (rtx_insn *insn, bool repla
                      }
                    lra_update_insn_recog_data (insn);
                    /* Add offset note for future updates.  */
-                   add_reg_note (insn, REG_EQUAL, src);
+                   add_reg_note (insn, REG_EQUAL, copy_rtx (src));
                    return;
                  }
              }

Reply via email to