This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Remove bogus asserts in IRA



This patches removes a couple bogus asserts and properly preconditions ALLOCNO_UPDATED_HARD_REG_COSTS prior to the main body of update_curr_costs running.


update_curr_costs calculates the impact of all connected copies from scratch; callers currently assert that ALLOCNO_UPDATED_HARD_REG_COSTS is null prior to the call.

At the bottom of assign_hard_reg we have:

  for (a = ALLOCNO_NEXT_COALESCED_ALLOCNO (allocno);;
       a = ALLOCNO_NEXT_COALESCED_ALLOCNO (a))
    {
      ALLOCNO_HARD_REGNO (a) = best_hard_regno;
      ALLOCNO_ASSIGNED_P (a) = true;
      if (best_hard_regno >= 0)
        update_copy_costs (a, true);
      ira_assert (ALLOCNO_COVER_CLASS (a) == cover_class);
      /* We don't need updated costs anymore: */
      ira_free_allocno_updated_costs (a);
      if (a == allocno)
        break;
    }

Note the call to update_copy_costs which iterates over the copies and adjusts costs *for the copies* via:

ira_allocate_and_set_or_copy_costs
(&ALLOCNO_UPDATED_HARD_REG_COSTS (another_allocno), cover_class,
ALLOCNO_UPDATED_COVER_CLASS_COST (another_allocno),
ALLOCNO_HARD_REG_COSTS (another_allocno));


If we later call allocno_reload_assign on one of those copies, we'll trigger the assert prior to the call to update_curr_costs.


After discussing the problem with Vlad, he recommended the asserts be removed and that we should call ira_free_allocno_updated_costs at the beginning of update_curr_costs.


Bootstrapped and regression tested on x86_64-unknown-linux-gnu. OK for trunk?

Jeff

Attachment: P
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]