Unrecog insns (such as CLOBBER, USE) does not represent real instructions, 
but in the
process of pipeline optimization, they will wait for transmission in ready list 
like
other insns, without considering resource conflicts and cycles. This results in 
a
multi-issue CPU architecture that can be issued at any time if other regular 
insns
have resource conflicts or cannot be launched for other reasons. As a result, 
its
position is advanced in the generated insns sequence, which will affect register
allocation and often lead to more redundant mov instructions.

gcc/ChangeLog:

        * haifa-sched.cc (prune_ready_list): Consider unrecog insns(CLOBBER and 
USE)
        in pruning ready lists.
---
 gcc/haifa-sched.cc | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/gcc/haifa-sched.cc b/gcc/haifa-sched.cc
index 48b53776fa9..72c4c44da76 100644
--- a/gcc/haifa-sched.cc
+++ b/gcc/haifa-sched.cc
@@ -6318,6 +6318,14 @@ prune_ready_list (state_t temp_state, bool 
first_cycle_insn_p,
              cost = 1;
              reason = "not a shadow";
            }
+         else if (recog_memoized (insn) < 0
+                 && (GET_CODE (PATTERN (insn)) == CLOBBER
+                 || GET_CODE (PATTERN (insn)) == USE))
+           {
+             if (!first_cycle_insn_p)
+               cost = 1;
+             reason = "unrecog insn";
+           }
          else if (recog_memoized (insn) < 0)
            {
              if (!first_cycle_insn_p
-- 
2.17.1

Reply via email to