[Bug rtl-optimization/79388] [6/7 Regression] wrong code with -O -fno-tree-coalesce-vars

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Feb 10 11:26:00 GMT 2017


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

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
--- gcc/combine.c.jj    2017-01-30 09:31:48.000000000 +0100
+++ gcc/combine.c       2017-02-10 12:16:18.507855160 +0100
@@ -14288,6 +14288,11 @@ distribute_notes (rtx notes, rtx_insn *f
                                            NULL_RTX, NULL_RTX, NULL_RTX);
                          distribute_links (LOG_LINKS (tem_insn));

+                         unsigned int regno = REGNO (XEXP (note, 0));
+                         reg_stat_type *rsp = &reg_stat[regno];
+                         if (rsp->last_set == tem_insn)
+                           record_value_for_reg (XEXP (note, 0), NULL,
NULL_RTX);
+
                          SET_INSN_DELETED (tem_insn);
                          if (tem_insn == i2)
                            i2 = NULL;

fixes both testcases by making sure that if we delete the instruction that is
still considered to be the setter of the last value, we also invalidate what
we've remembered for it.  No idea whether this is the right spot or right way
to invalidate that though.  Segher?


More information about the Gcc-bugs mailing list