public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH v1] Fix compare-debug bootstrap failure
@ 2024-01-17 15:40 Maxim Kuvyrkov
  2024-01-17 17:07 ` Jakub Jelinek
  0 siblings, 1 reply; 2+ messages in thread
From: Maxim Kuvyrkov @ 2024-01-17 15:40 UTC (permalink / raw)
  To: gcc-patches; +Cc: Maxim Kuvyrkov, Richard Guenther, Vladimir Makarov, Jeff Law

... caused by scheduler fix for PR96388 and PR111554.

This patch adjusts decision sched-deps.cc:find_inc() to use
length of dependency lists sans any DEBUG_INSN instructions.

gcc/ChangeLog:

	* haifa-sched.cc (dep_list_size): Make global.
	* sched-deps.cc (find_inc): Use instead of sd_lists_size().
	* sched-int.h (dep_list_size): Declare.
---
 gcc/haifa-sched.cc | 8 ++++++--
 gcc/sched-deps.cc  | 6 +++---
 gcc/sched-int.h    | 2 ++
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/gcc/haifa-sched.cc b/gcc/haifa-sched.cc
index 49ee589aed7..1bc610f9a5f 100644
--- a/gcc/haifa-sched.cc
+++ b/gcc/haifa-sched.cc
@@ -1560,8 +1560,7 @@ contributes_to_priority_p (dep_t dep)
 }
 
 /* Compute the number of nondebug deps in list LIST for INSN.  */
-
-static int
+int
 dep_list_size (rtx_insn *insn, sd_list_types_def list)
 {
   sd_iterator_def sd_it;
@@ -1571,6 +1570,11 @@ dep_list_size (rtx_insn *insn, sd_list_types_def list)
   if (!MAY_HAVE_DEBUG_INSNS)
     return sd_lists_size (insn, list);
 
+  /* TODO: We should split normal and debug insns into separate SD_LIST_*
+     sub-lists, and then we'll be able to use something like
+     sd_lists_size(insn, list & SD_LIST_NON_DEBUG)
+     instead of walking dependencies below.  */
+
   FOR_EACH_DEP (insn, list, sd_it, dep)
     {
       if (DEBUG_INSN_P (DEP_CON (dep)))
diff --git a/gcc/sched-deps.cc b/gcc/sched-deps.cc
index 0615007c560..5034e664e5e 100644
--- a/gcc/sched-deps.cc
+++ b/gcc/sched-deps.cc
@@ -4791,7 +4791,7 @@ find_inc (struct mem_inc_info *mii, bool backwards)
   sd_iterator_def sd_it;
   dep_t dep;
   sd_list_types_def mem_deps = backwards ? SD_LIST_HARD_BACK : SD_LIST_FORW;
-  int n_mem_deps = sd_lists_size (mii->mem_insn, mem_deps);
+  int n_mem_deps = dep_list_size (mii->mem_insn, mem_deps);
 
   sd_it = sd_iterator_start (mii->mem_insn, mem_deps);
   while (sd_iterator_cond (&sd_it, &dep))
@@ -4808,12 +4808,12 @@ find_inc (struct mem_inc_info *mii, bool backwards)
       if (backwards)
 	{
 	  inc_cand = pro;
-	  n_inc_deps = sd_lists_size (inc_cand, SD_LIST_BACK);
+	  n_inc_deps = dep_list_size (inc_cand, SD_LIST_BACK);
 	}
       else
 	{
 	  inc_cand = con;
-	  n_inc_deps = sd_lists_size (inc_cand, SD_LIST_FORW);
+	  n_inc_deps = dep_list_size (inc_cand, SD_LIST_FORW);
 	}
 
       /* In the FOR_EACH_DEP loop below we will create additional n_inc_deps
diff --git a/gcc/sched-int.h b/gcc/sched-int.h
index ab784fe0d17..4df092013e9 100644
--- a/gcc/sched-int.h
+++ b/gcc/sched-int.h
@@ -1677,6 +1677,8 @@ extern void sd_copy_back_deps (rtx_insn *, rtx_insn *, bool);
 extern void sd_delete_dep (sd_iterator_def);
 extern void sd_debug_lists (rtx, sd_list_types_def);
 
+extern int dep_list_size (rtx_insn *, sd_list_types_def);
+
 /* Macros and declarations for scheduling fusion.  */
 #define FUSION_MAX_PRIORITY (INT_MAX)
 extern bool sched_fusion;
-- 
2.34.1


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

* Re: [PATCH v1] Fix compare-debug bootstrap failure
  2024-01-17 15:40 [PATCH v1] Fix compare-debug bootstrap failure Maxim Kuvyrkov
@ 2024-01-17 17:07 ` Jakub Jelinek
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Jelinek @ 2024-01-17 17:07 UTC (permalink / raw)
  To: Maxim Kuvyrkov; +Cc: gcc-patches, Richard Guenther, Vladimir Makarov, Jeff Law

On Wed, Jan 17, 2024 at 03:40:20PM +0000, Maxim Kuvyrkov wrote:
> ... caused by scheduler fix for PR96388 and PR111554.
> 
> This patch adjusts decision sched-deps.cc:find_inc() to use
> length of dependency lists sans any DEBUG_INSN instructions.
> 
> gcc/ChangeLog:
> 

Please mention
	PR bootstrap/113445
here

> 	* haifa-sched.cc (dep_list_size): Make global.
> 	* sched-deps.cc (find_inc): Use instead of sd_lists_size().
> 	* sched-int.h (dep_list_size): Declare.

and include some testcase from the PR into the testsuite.
Otherwise LGTM.

	Jakub


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

end of thread, other threads:[~2024-01-17 17:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-17 15:40 [PATCH v1] Fix compare-debug bootstrap failure Maxim Kuvyrkov
2024-01-17 17:07 ` Jakub Jelinek

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