public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/110254] New: improve_allocation() routine does not update allocated_hardreg_p[] array
@ 2023-06-14 17:10 jskumari at gcc dot gnu.org
  2023-06-14 18:53 ` [Bug rtl-optimization/110254] " segher at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: jskumari at gcc dot gnu.org @ 2023-06-14 17:10 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug rtl-optimization/110254] improve_allocation() routine does not update allocated_hardreg_p[] array
  2023-06-14 17:10 [Bug rtl-optimization/110254] New: improve_allocation() routine does not update allocated_hardreg_p[] array jskumari at gcc dot gnu.org
@ 2023-06-14 18:53 ` segher at gcc dot gnu.org
  2023-06-23 20:10 ` bergner at gcc dot gnu.org
  2023-08-16 17:21 ` cvs-commit at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: segher at gcc dot gnu.org @ 2023-06-14 18:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Segher Boessenkool <segher at gcc dot gnu.org> ---
Off topic / pet peeve: it's not an array of functions, so it should not be
called
something_p .

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug rtl-optimization/110254] improve_allocation() routine does not update allocated_hardreg_p[] array
  2023-06-14 17:10 [Bug rtl-optimization/110254] New: improve_allocation() routine does not update allocated_hardreg_p[] array jskumari at gcc dot gnu.org
  2023-06-14 18:53 ` [Bug rtl-optimization/110254] " segher at gcc dot gnu.org
@ 2023-06-23 20:10 ` bergner at gcc dot gnu.org
  2023-08-16 17:21 ` cvs-commit at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: bergner at gcc dot gnu.org @ 2023-06-23 20:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Peter Bergner <bergner at gcc dot gnu.org> ---
(In reply to Surya Kumari Jangala from comment #0)
> 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.

Be cognizant of if the allocno we're reassigning to another "hardreg", has a
mode that represents a register pair or larger, you'll need to update multiple
allocated_hardreg_p[] entries.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug rtl-optimization/110254] improve_allocation() routine does not update allocated_hardreg_p[] array
  2023-06-14 17:10 [Bug rtl-optimization/110254] New: improve_allocation() routine does not update allocated_hardreg_p[] array jskumari at gcc dot gnu.org
  2023-06-14 18:53 ` [Bug rtl-optimization/110254] " segher at gcc dot gnu.org
  2023-06-23 20:10 ` bergner at gcc dot gnu.org
@ 2023-08-16 17:21 ` cvs-commit at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-08-16 17:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Surya Kumari Jangala
<jskumari@gcc.gnu.org>:

https://gcc.gnu.org/g:02ecc9a26324d142c5cd19d24526b9c23aabc1c3

commit r14-3251-g02ecc9a26324d142c5cd19d24526b9c23aabc1c3
Author: Surya Kumari Jangala <jskumari@linux.ibm.com>
Date:   Mon Aug 14 09:34:56 2023 -0500

    ira: update allocated_hardreg_p[] in improve_allocation() [PR110254]

    The improve_allocation() routine does not update the
    allocated_hardreg_p[] array after an allocno is assigned a register.

    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.

    2023-07-21  Surya Kumari Jangala  <jskumari@linux.ibm.com>

    gcc/
            PR rtl-optimization/110254
            * ira-color.cc (improve_allocation): Update array
            allocated_hard_reg_p.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-08-16 17:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-14 17:10 [Bug rtl-optimization/110254] New: improve_allocation() routine does not update allocated_hardreg_p[] array jskumari at gcc dot gnu.org
2023-06-14 18:53 ` [Bug rtl-optimization/110254] " segher at gcc dot gnu.org
2023-06-23 20:10 ` bergner at gcc dot gnu.org
2023-08-16 17:21 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).