gcc/
        * haifa-sched.c (dep_list_costs): New.
        (rank_for_schedule): Use dep_list_costs.

---
 gcc/haifa-sched.c | 31 +++++++++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 350178c82b8..32cd640bb67 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -1584,6 +1584,33 @@ dep_list_size (rtx_insn *insn, sd_list_types_def list)
   return nodbgcount;
 }
 
+/* Compute the costs of nondebug deps in list LIST for INSN.  */
+
+static int
+dep_list_costs (rtx_insn *insn, sd_list_types_def list)
+{
+  sd_iterator_def sd_it;
+  dep_t dep;
+  int costs = 0;
+
+  FOR_EACH_DEP (insn, list, sd_it, dep)
+    {
+      if (!DEBUG_INSN_P (DEP_CON (dep))
+         && !DEBUG_INSN_P (DEP_PRO (dep)))
+       {
+         int bypass = INSN_CODE (DEP_PRO (dep)) >= 0
+               && bypass_p (DEP_PRO (dep))
+               && recog_memoized (DEP_CON (dep)) >= 0
+               && !dep_cost (dep);
+
+         if (!bypass)
+           costs++;
+       }
+    }
+
+  return costs;
+}
+
 bool sched_fusion;
 
 /* Compute the priority number for INSN.  */
@@ -2795,8 +2822,8 @@ rank_for_schedule (const void *x, const void *y)
      This gives the scheduler more freedom when scheduling later
      instructions at the expense of added register pressure.  */
 
-  val = (dep_list_size (tmp2, SD_LIST_FORW)
-        - dep_list_size (tmp, SD_LIST_FORW));
+  val = (dep_list_costs (tmp2, SD_LIST_FORW)
+        - dep_list_costs (tmp, SD_LIST_FORW));
 
   if (flag_sched_dep_count_heuristic && val != 0)
     return rfs_result (RFS_DEP_COUNT, val, tmp, tmp2);
-- 
2.24.3 (Apple Git-128)

Reply via email to