From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out30-101.freemail.mail.aliyun.com (out30-101.freemail.mail.aliyun.com [115.124.30.101]) by sourceware.org (Postfix) with ESMTPS id 0390D385B516 for ; Thu, 23 Mar 2023 08:08:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0390D385B516 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.alibaba.com X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R351e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046056;MF=jinma@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0VeTcepU_1679558880; Received: from localhost.localdomain(mailfrom:jinma@linux.alibaba.com fp:SMTPD_---0VeTcepU_1679558880) by smtp.aliyun-inc.com; Thu, 23 Mar 2023 16:08:02 +0800 From: Jin Ma To: gcc-patches@gcc.gnu.org Cc: kito.cheng@sifive.com, kito.cheng@gmail.com, palmer@dabbelt.com, jeffreyalaw@gmail.com, ijinma@yeah.net, Jin Ma Subject: [PATCH] In the ready lists of pipeline, put unrecog insns (such as CLOBBER,USE) at the latest to issue. Date: Thu, 23 Mar 2023 16:07:34 +0800 Message-Id: <20230323080734.423-1-jinma@linux.alibaba.com> X-Mailer: git-send-email 2.38.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-21.2 required=5.0 tests=BAYES_00,ENV_AND_HDR_SPF_MATCH,GIT_PATCH_0,KAM_DMARC_STATUS,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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