public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/110071] New: improve_allocation() routine should consider save/restore cost of callee-save registers
@ 2023-06-01 7:55 jskumari at gcc dot gnu.org
2023-09-20 1:55 ` [Bug rtl-optimization/110071] " cvs-commit 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-01 7:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110071
Bug ID: 110071
Summary: improve_allocation() routine should consider
save/restore cost of callee-save registers
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: ---
For the following test:
long
foo (long i, long cond)
{
if (cond)
bar ();
return i+1;
}
Input RTL to IRA:
BB2:
set r123, r4
set r122, r3
set r120, compare(r123, 0)
set r118, r122
if r120 jump BB4 else jump BB3
BB3:
call bar()
BB4:
set r3, r118+1
return r3
IRA assigns r31 to r118.
Since r31 is a callee save register in powerpc, we need to generate
spill/restore code.
This assignment of r31 to r118 causes shrink wrap to fail for this test.
Since r31 is assigned to r118, BB2 requires a prolog and shrink wrap fails.
In the IRA pass, after graph coloring, r118 gets assigned to r3.
The routine improve_allocation() is called after graph coloring. This routine
changes the assignment of r118 to r31.
In improve_allocation() routine, IRA checks for each allocno if spilling any
conflicting allocnos can improve the allocation of this allocno. This routine
computes the cost improvement for usage of each profitable hard register for a
given allocno.
The existing code in improve_allocation() does not consider the save/restore
costs of callee save registers while computing the cost improvement.
This bug is for adding save/restore costs while computing cost improvement.
Save/restore costs should be considered only for the first assignment of a
callee save register. Subsequent assignments of the same register do not need
to consider this cost.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug rtl-optimization/110071] improve_allocation() routine should consider save/restore cost of callee-save registers
2023-06-01 7:55 [Bug rtl-optimization/110071] New: improve_allocation() routine should consider save/restore cost of callee-save registers jskumari at gcc dot gnu.org
@ 2023-09-20 1:55 ` cvs-commit at gcc dot gnu.org
2024-02-01 8:52 ` jskumari at gcc dot gnu.org
2024-02-01 8:54 ` jskumari at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-20 1:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110071
--- Comment #1 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:677249a23243b5b51832611767366d6eb199bdc7
commit r14-4162-g677249a23243b5b51832611767366d6eb199bdc7
Author: Surya Kumari Jangala <jskumari@linux.ibm.com>
Date: Thu Sep 14 02:12:50 2023 -0500
ira: Consider save/restore costs of callee-save registers [PR110071]
In improve_allocation() routine, IRA checks for each allocno if spilling
any conflicting allocnos can improve the allocation of this allocno.
This routine computes the cost improvement for usage of each profitable
hard register for a given allocno. The existing code in
improve_allocation() does not consider the save/restore costs of callee
save registers while computing the cost improvement.
This can result in a callee save register being assigned to a pseudo
that is live in the entire function and across a call, overriding a
non-callee save register assigned to the pseudo by graph coloring. So
the entry basic block requires a prolog, thereby causing shrink wrap to
fail.
2023-09-14 Surya Kumari Jangala <jskumari@linux.ibm.com>
gcc/
PR rtl-optimization/110071
* ira-color.cc (improve_allocation): Consider cost of callee
save registers.
gcc/testsuite/
PR rtl-optimization/110071
* gcc.target/powerpc/pr110071.c: New test.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug rtl-optimization/110071] improve_allocation() routine should consider save/restore cost of callee-save registers
2023-06-01 7:55 [Bug rtl-optimization/110071] New: improve_allocation() routine should consider save/restore cost of callee-save registers jskumari at gcc dot gnu.org
2023-09-20 1:55 ` [Bug rtl-optimization/110071] " cvs-commit at gcc dot gnu.org
@ 2024-02-01 8:52 ` jskumari at gcc dot gnu.org
2024-02-01 8:54 ` jskumari at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: jskumari at gcc dot gnu.org @ 2024-02-01 8:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110071
Surya Kumari Jangala <jskumari at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2024-02-01
Status|UNCONFIRMED |ASSIGNED
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug rtl-optimization/110071] improve_allocation() routine should consider save/restore cost of callee-save registers
2023-06-01 7:55 [Bug rtl-optimization/110071] New: improve_allocation() routine should consider save/restore cost of callee-save registers jskumari at gcc dot gnu.org
2023-09-20 1:55 ` [Bug rtl-optimization/110071] " cvs-commit at gcc dot gnu.org
2024-02-01 8:52 ` jskumari at gcc dot gnu.org
@ 2024-02-01 8:54 ` jskumari at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: jskumari at gcc dot gnu.org @ 2024-02-01 8:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110071
Surya Kumari Jangala <jskumari at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #2 from Surya Kumari Jangala <jskumari at gcc dot gnu.org> ---
Fixed by the commit in comment 1.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-02-01 8:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-01 7:55 [Bug rtl-optimization/110071] New: improve_allocation() routine should consider save/restore cost of callee-save registers jskumari at gcc dot gnu.org
2023-09-20 1:55 ` [Bug rtl-optimization/110071] " cvs-commit at gcc dot gnu.org
2024-02-01 8:52 ` jskumari at gcc dot gnu.org
2024-02-01 8:54 ` jskumari 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).