public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] ira: Fix old-reload targets [PR103974]
@ 2022-01-11 17:42 Richard Sandiford
  2022-01-11 18:38 ` Vladimir Makarov
  0 siblings, 1 reply; 11+ messages in thread
From: Richard Sandiford @ 2022-01-11 17:42 UTC (permalink / raw)
  To: gcc-patches

The new IRA heuristics would need more work on old-reload targets,
since flattening needs to be able to undo the cost propagation.
It's doable, but hardly seems worth it.

This patch therefore makes all the new calls to
ira_subloop_allocnos_can_differ_p return false if !ira_use_lra_p.
The color_pass code that predated the new function (and that was
the source of ira_subloop_allocnos_can_differ_p) continues to
behave as before.

It's a hack, but at least it has the advantage that the new parameter
would become obviously unused if reload and (!)ira_use_lra_p were
removed.  The hack should therefore disappear alongside reload.

Tested on aarch64-linux-gnu and cris-elf.  OK to install?

Richard


gcc/
	PR rtl-optimization/103974
	* ira-int.h (ira_subloop_allocnos_can_differ_p): Take an
	extra argument, default true, that says whether old-reload
	targets should be excluded.
	* ira-color.c (color_pass): Pass false.
---
 gcc/ira-color.c |  3 ++-
 gcc/ira-int.h   | 10 ++++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/gcc/ira-color.c b/gcc/ira-color.c
index 36f3f4d70f3..59d978fe9b3 100644
--- a/gcc/ira-color.c
+++ b/gcc/ira-color.c
@@ -3664,7 +3664,8 @@ color_pass (ira_loop_tree_node_t loop_tree_node)
 	  ira_assert (bitmap_bit_p (subloop_node->all_allocnos,
 				    ALLOCNO_NUM (subloop_allocno)));
 	  if (ira_single_region_allocno_p (a, subloop_allocno)
-	      || !ira_subloop_allocnos_can_differ_p (a, hard_regno >= 0))
+	      || !ira_subloop_allocnos_can_differ_p (a, hard_regno >= 0,
+						     false))
 	    {
 	      gcc_assert (!ALLOCNO_MIGHT_CONFLICT_WITH_PARENT_P
 			  (subloop_allocno));
diff --git a/gcc/ira-int.h b/gcc/ira-int.h
index e1e68025211..e80fdeb0328 100644
--- a/gcc/ira-int.h
+++ b/gcc/ira-int.h
@@ -1607,10 +1607,16 @@ ira_loop_border_costs::move_between_loops_cost () const
 
 /* Return true if subloops that contain allocnos for A's register can
    use a different assignment from A.  ALLOCATED_P is true for the case
-   in which allocation succeeded for A.  */
+   in which allocation succeeded for A.  EXCLUDE_OLD_RELOAD is true if
+   we should always return false for non-LRA targets.  (This is a hack
+   and should be removed along with old reload.)  */
 inline bool
-ira_subloop_allocnos_can_differ_p (ira_allocno_t a, bool allocated_p = true)
+ira_subloop_allocnos_can_differ_p (ira_allocno_t a, bool allocated_p = true,
+				   bool exclude_old_reload = true)
 {
+  if (exclude_old_reload && !ira_use_lra_p)
+    return false;
+
   auto regno = ALLOCNO_REGNO (a);
 
   if (pic_offset_table_rtx != NULL
-- 
2.25.1

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

end of thread, other threads:[~2022-01-12 18:43 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-11 17:42 [PATCH] ira: Fix old-reload targets [PR103974] Richard Sandiford
2022-01-11 18:38 ` Vladimir Makarov
2022-01-12  8:47   ` Richard Biener
2022-01-12 14:26     ` Vladimir Makarov
2022-01-12 15:00       ` Richard Biener
2022-01-12 15:12         ` Richard Biener
2022-01-12 18:40           ` Maciej W. Rozycki
2022-01-12 15:58         ` Jeff Law
2022-01-12 18:12           ` Hans-Peter Nilsson
2022-01-12 18:13           ` Hans-Peter Nilsson
2022-01-12 18:43             ` Koning, Paul

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).