df_analyze set up luids are more-or-less still valid.  The only
insn changes at this point are due to combine_and_move_insns.

        * ira.c (add_store_equivs): Use DF_INSN_LUID rather than
        bitmap seen_insns.

diff --git a/gcc/ira.c b/gcc/ira.c
index cfd448c..1cace25 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -3567,17 +3567,12 @@ update_equiv_regs (void)
 static void
 add_store_equivs (void)
 {
-  bitmap_head seen_insns;
-
-  bitmap_initialize (&seen_insns, NULL);
   for (rtx_insn *insn = get_insns (); insn; insn = NEXT_INSN (insn))
     {
       rtx set, src, dest;
       unsigned regno;
       rtx_insn *init_insn;
 
-      bitmap_set_bit (&seen_insns, INSN_UID (insn));
-
       if (! INSN_P (insn))
        continue;
 
@@ -3597,7 +3592,11 @@ add_store_equivs (void)
          && ! reg_equiv[regno].pdx_subregs
          && reg_equiv[regno].init_insns != NULL
          && (init_insn = reg_equiv[regno].init_insns->insn ()) != 0
-         && bitmap_bit_p (&seen_insns, INSN_UID (init_insn))
+         /* combine_and_move_insns may have created a new insn for
+            init_insn.  If we hit one of those its luid will be zero,
+            but that's OK as we know it is immediately before insn.
+            For all other cases the luids should be valid.  */
+         && DF_INSN_LUID (init_insn) < DF_INSN_LUID (insn)
          && ! find_reg_note (init_insn, REG_EQUIV, NULL_RTX)
          && validate_equiv_mem (init_insn, src, dest)
          && ! memref_used_between_p (dest, init_insn, insn)
@@ -3617,7 +3616,6 @@ add_store_equivs (void)
                     INSN_UID (insn));
        }
     }
-  bitmap_clear (&seen_insns);
 }
 
 /* Scan all regs killed in an insn to see if any of them are registers

-- 
Alan Modra
Australia Development Lab, IBM

Reply via email to