public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [pushed] [IRA]: Fixing conflict calculation from region landing pads.
@ 2023-11-09 18:25 Vladimir Makarov
  0 siblings, 0 replies; only message in thread
From: Vladimir Makarov @ 2023-11-09 18:25 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 163 bytes --]

This is one more patch for

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

The patch was successfully tested and bootstrapped on x86-64, aarch64, 
ppc64le.


[-- Attachment #2: pr110215-2.patch --]
[-- Type: text/x-patch, Size: 3066 bytes --]

commit df14f1c0582cd6742a37abf3a97f4c4bf0caf864
Author: Vladimir N. Makarov <vmakarov@redhat.com>
Date:   Thu Nov 9 08:51:15 2023 -0500

    [IRA]: Fixing conflict calculation from region landing pads.
    
    The following patch fixes conflict calculation from exception landing
    pads.  The previous patch processed only one newly created landing pad.
    Besides it was wrong, it also resulted in large memory consumption by IRA.
    
    gcc/ChangeLog:
    
            PR rtl-optimization/110215
            * ira-lives.cc: (add_conflict_from_region_landing_pads): New
            function.
            (process_bb_node_lives): Use it.

diff --git a/gcc/ira-lives.cc b/gcc/ira-lives.cc
index bc8493856a4..81af5c06460 100644
--- a/gcc/ira-lives.cc
+++ b/gcc/ira-lives.cc
@@ -1214,6 +1214,32 @@ process_out_of_region_eh_regs (basic_block bb)
 
 #endif
 
+/* Add conflicts for object OBJ from REGION landing pads using CALLEE_ABI.  */
+static void
+add_conflict_from_region_landing_pads (eh_region region, ira_object_t obj,
+				       function_abi callee_abi)
+{
+  ira_allocno_t a = OBJECT_ALLOCNO (obj);
+  rtx_code_label *landing_label;
+  basic_block landing_bb;
+
+  for (eh_landing_pad lp = region->landing_pads; lp ; lp = lp->next_lp)
+    {
+      if ((landing_label = lp->landing_pad) != NULL
+	  && (landing_bb = BLOCK_FOR_INSN (landing_label)) != NULL
+	  && (region->type != ERT_CLEANUP
+	      || bitmap_bit_p (df_get_live_in (landing_bb),
+			       ALLOCNO_REGNO (a))))
+	{
+	  HARD_REG_SET new_conflict_regs
+	    = callee_abi.mode_clobbers (ALLOCNO_MODE (a));
+	  OBJECT_CONFLICT_HARD_REGS (obj) |= new_conflict_regs;
+	  OBJECT_TOTAL_CONFLICT_HARD_REGS (obj) |= new_conflict_regs;
+	  return;
+	}
+    }
+}
+
 /* Process insns of the basic block given by its LOOP_TREE_NODE to
    update allocno live ranges, allocno hard register conflicts,
    intersected calls, and register pressure info for allocnos for the
@@ -1385,23 +1411,9 @@ process_bb_node_lives (ira_loop_tree_node_t loop_tree_node)
 		      SET_HARD_REG_SET (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj));
 		    }
 		  eh_region r;
-		  eh_landing_pad lp;
-		  rtx_code_label *landing_label;
-		  basic_block landing_bb;
 		  if (can_throw_internal (insn)
-		      && (r = get_eh_region_from_rtx (insn)) != NULL
-		      && (lp = gen_eh_landing_pad (r)) != NULL
-		      && (landing_label = lp->landing_pad) != NULL
-		      && (landing_bb = BLOCK_FOR_INSN (landing_label)) != NULL
-		      && (r->type != ERT_CLEANUP
-			  || bitmap_bit_p (df_get_live_in (landing_bb),
-					   ALLOCNO_REGNO (a))))
-		    {
-		      HARD_REG_SET new_conflict_regs
-			= callee_abi.mode_clobbers (ALLOCNO_MODE (a));
-		      OBJECT_CONFLICT_HARD_REGS (obj) |= new_conflict_regs;
-		      OBJECT_TOTAL_CONFLICT_HARD_REGS (obj) |= new_conflict_regs;
-		    }
+		      && (r = get_eh_region_from_rtx (insn)) != NULL)
+		    add_conflict_from_region_landing_pads (r, obj, callee_abi);
 		  if (sparseset_bit_p (allocnos_processed, num))
 		    continue;
 		  sparseset_set_bit (allocnos_processed, num);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-11-09 18:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-09 18:25 [pushed] [IRA]: Fixing conflict calculation from region landing pads Vladimir Makarov

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