gcc/
        * haifa-sched.c (rank_for_schedule): Add bypass_p
        cost check in flag_sched_last_insn_heuristic.

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

diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 62d1816a55d..adf63659d15 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -2780,10 +2780,14 @@ rank_for_schedule (const void *x, const void *y)
          1) Data dependent on last schedule insn.
          2) Anti/Output dependent on last scheduled insn.
          3) Independent of last scheduled insn, or has latency of one.
+         4) bypass of last scheduled insn, and has latency of zero.
          Choose the insn from the highest numbered class if different.  */
       dep1 = sd_find_dep_between (last, tmp, true);
 
-      if (dep1 == NULL || dep_cost (dep1) == 1)
+      if (dep1 == NULL || dep_cost (dep1) == 1
+         || (INSN_CODE (DEP_PRO (dep1)) >= 0 && bypass_p (DEP_PRO (dep1))
+             && recog_memoized (DEP_CON (dep1)) >= 0
+             && !dep_cost (dep1)))
        tmp_class = 3;
       else if (/* Data dependence.  */
               DEP_TYPE (dep1) == REG_DEP_TRUE)
@@ -2793,7 +2797,10 @@ rank_for_schedule (const void *x, const void *y)
 
       dep2 = sd_find_dep_between (last, tmp2, true);
 
-      if (dep2 == NULL || dep_cost (dep2)  == 1)
+      if (dep2 == NULL || dep_cost (dep2)  == 1
+         || (INSN_CODE (DEP_PRO (dep2)) >= 0 && bypass_p (DEP_PRO (dep2))
+             && recog_memoized (DEP_CON (dep2)) >= 0
+             && !dep_cost (dep2)))
        tmp2_class = 3;
       else if (/* Data dependence.  */
               DEP_TYPE (dep2) == REG_DEP_TRUE)
-- 
2.24.3 (Apple Git-128)

Reply via email to