https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104686
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2022-03-01
Status|UNCONFIRMED |NEW
--- Comment #15 from Richard Biener <rguenth at gcc dot gnu.org> ---
So we have a lot of allocnos and do
Popping a2027(r13053,l1) -- assign reg 46
Popping a2217(r12829,l1) -- assign reg 46
Popping a2407(r12603,l1) -- assign reg 45
Popping a2015(r162,l1) -- assign reg 48
...
thus pop_allocnos_from_stack () which will eventually call
assign_hard_reg (allocno, false) which then calls
update_conflict_hard_regno_costs twice for the ALLOCNO_CLASS.
I wonder if it makes sense to pop allocnos of the same class w/o updating
the hard regno cost and do the update only after each such group.
I know nothing about IRA but
diff --git a/gcc/ira-color.cc b/gcc/ira-color.cc
index 8b6db1bb417..3a531c0e537 100644
--- a/gcc/ira-color.cc
+++ b/gcc/ira-color.cc
@@ -2905,7 +2905,11 @@ pop_allocnos_from_stack (void)
if (internal_flag_ira_verbose > 3 && ira_dump_file != NULL)
fprintf (ira_dump_file, "assign memory\n");
}
- else if (assign_hard_reg (allocno, false))
+ else if (assign_hard_reg (allocno,
+ allocno_stack_vec.is_empty ()
+ || (ALLOCNO_CLASS (allocno_stack_vec.last ())
+ != aclass)
+ ? false : true))
{
if (internal_flag_ira_verbose > 3 && ira_dump_file != NULL)
fprintf (ira_dump_file, " assign reg %d\n",
speeds up compilation (with -O0 cc1) to
integrated RA : 5.27 ( 29%) 0.27 ( 13%) 5.67 ( 28%)
3429k ( 11%)
TOTAL : 18.26 2.02 20.52
31M
from
integrated RA : 74.11 ( 94%) 0.02 ( 29%) 74.67 ( 94%)
3429k ( 11%)
TOTAL : 78.73 0.07 79.39
31M
on the partially reduced testcase.
Maybe that's too aggressive of course. From the dump we also see we
assign the same hardreg to adjacent popped allocnos so maybe that's
another way to "group" the cost adjustments:
Popping a20939(r7366,l0: a16841(r7366,l1: a8854(r7366,l2))) --
assign reg 50
Popping a20951(r7347,l0: a16853(r7347,l1: a8866(r7347,l2))) --
assign reg 50
... 172 times assigning reg 50
Popping a21383(r6857,l0: a17285(r6857,l1: a9298(r6857,l2))) --
assign reg 50