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

            Bug ID: 110254
           Summary: improve_allocation() routine does not update
                    allocated_hardreg_p[] array
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jskumari at gcc dot gnu.org
  Target Milestone: ---

"allocated_hardreg_p[]" is a boolean array whose element value is TRUE is the
corresponding hard register was already allocated for an allocno.
This array is used in calculate_saved_nregs().

The improve_allocation() function improves the allocation by spilling some
allocnos and assigning the freed hard registers to other allocnos if it
decreases the overall allocation cost.

If the register chosen in improve_allocation() is one that already has been
assigned to a conflicting allocno, then allocated_hardreg_p[] already has the
corresponding bit set to TRUE, so nothing needs to be done.

But improve_allocation() can also choose a register that has not been assigned
to a conflicting allocno, and also has not been assigned to any other allocno.
In this case, allocated_hardreg_p[] has to be updated. improve_allocation()
calls assign_hard_reg() to check if any of the spilled allocnos can get hard
registers.
And assign_hard_reg() calls calculate_saved_nregs() which uses the array.
Hence, the array needs to be updated.

Reply via email to