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

            Bug ID: 80126
           Summary: df_ref_change_reg_with_loc does not update
                    hard_regs_live_count
           Product: gcc
           Version: 6.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: stefan at franke dot ms
  Target Milestone: ---

The method


static void
df_ref_change_reg_with_loc_1 (struct df_reg_info *old_df,
                              struct df_reg_info *new_df,
                              unsigned int new_regno, rtx loc)

does not update the hard_regs_live_count.

Old:

...
          struct df_insn_info *insn_info = DF_REF_INSN_INFO (the_ref);

          DF_REF_REGNO (the_ref) = new_regno;
...

Fixed:

...
          struct df_insn_info *insn_info = DF_REF_INSN_INFO (the_ref);

          if (DF_REF_FLAGS_IS_SET(the_ref, DF_HARD_REG_LIVE))
            {
              --df->hard_regs_live_count[DF_REF_REGNO(the_ref)];
              ++df->hard_regs_live_count[new_regno];
            }

          DF_REF_REGNO (the_ref) = new_regno;
...

Reply via email to