From patchwork Tue Apr 4 05:13:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liuhongt X-Patchwork-Id: 78850 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2784272vqo; Mon, 3 Apr 2023 22:17:06 -0700 (PDT) X-Google-Smtp-Source: AKy350ZxC2rBe11mBADsJvsXOpYboObXx0E7kJjfWBW95HURW2Cum6o5p1ew8H1KgYGMShehqpI6 X-Received: by 2002:a17:906:65c4:b0:931:bc4a:ce08 with SMTP id z4-20020a17090665c400b00931bc4ace08mr820279ejn.36.1680585426374; Mon, 03 Apr 2023 22:17:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680585426; cv=none; d=google.com; s=arc-20160816; b=rE1iHVaFUKwlIhyfImDMNTTYh3G8AoKgePiTHNVtlakU1v7PVXQq63nSsfnxIDfMgN Ulqudr8towU42R2I69zgD8VcRjuKak29pq1Fl36W9kYEhh2PDyLmJ5tJxev4+vPr5A1Z bZhh3TvZiBqqf5YsosO1NqH2H1BPCtWmIFTyTBp5w7kR4pWba1n2up9LyuoWpaCA5/Sm 9MWLQA1pG12XzeGJ6XKI2NFEfVwrLMkxpoM3pK0Bg9sDjyggVc8EJChQlF0XHXxMgz2o UqHuA0VU0w6Mk3/p2S5hKtZiieIuR+RUlXDUSAQDMLkIaEroFrqLwSFB86u2HVUjKL6e zAeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=gLt2q5/34RFDvkpnJ7SB2rqWKRxjZzVtvYfCdK0+Kyg=; b=MJSppxRIt4P0RtcpLOVcpcnrQFNskBLePTjhXh6/vOb+NdgOAa4/31tSXC3r1F1Hwf aWqkvNybAzvwPlvj89cGmlAnxnpMI5OqlmmSdZDRihUtNHm0Jsk8V7ZXWY8f1FDKyhuI YgpBfS8PB5pCo7FXtd8U+1l7dadxeNSh+Wv00gNweB0OyePWJrr/Rzu1u1nIwTjVhki3 4ZCfmACS9TbkJw421L3/ACzBSazU8WROu+HbxL/EEgtTP83vszj6Pui4i97VTryj4tf0 2rbpG9SHfSRFQVUYcqdtfB1xkwniyNfjntJ45QbmQdFfHzhKVA14lLltgGp+XI2eFo8f wYag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="G/qD6rAk"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id gq25-20020a170906e25900b0093b053a6655si9707083ejb.34.2023.04.03.22.17.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Apr 2023 22:17:06 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="G/qD6rAk"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 55151385841C for ; Tue, 4 Apr 2023 05:17:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 55151385841C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680585425; bh=gLt2q5/34RFDvkpnJ7SB2rqWKRxjZzVtvYfCdK0+Kyg=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=G/qD6rAk5j4II29Gl2chf91VVdympF55rYcQP+Dx9uAL+s49FCZ+VID8MRZ9nvlxw df8kXPfWwDqMJOV7y7Gx0vhe4/9gGDXCcJeoZVq0G+uV8N5/m23FZ+GlUQCvR6GTXY x+YXkDupUXyHBWlj2AUDZ9PYG41SZtn9R0Grnhxo= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by sourceware.org (Postfix) with ESMTPS id 856183858D1E for ; Tue, 4 Apr 2023 05:16:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 856183858D1E X-IronPort-AV: E=McAfee;i="6600,9927,10669"; a="407151901" X-IronPort-AV: E=Sophos;i="5.98,316,1673942400"; d="scan'208";a="407151901" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Apr 2023 22:15:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10669"; a="810093163" X-IronPort-AV: E=Sophos;i="5.98,316,1673942400"; d="scan'208";a="810093163" Received: from shvmail03.sh.intel.com ([10.239.245.20]) by orsmga004.jf.intel.com with ESMTP; 03 Apr 2023 22:15:47 -0700 Received: from shliclel4217.sh.intel.com (shliclel4217.sh.intel.com [10.239.240.127]) by shvmail03.sh.intel.com (Postfix) with ESMTP id 78B5810079CD; Tue, 4 Apr 2023 13:15:46 +0800 (CST) To: gcc-patches@gcc.gnu.org Cc: vmakarov@redhat.com Subject: [PATCH] Check hard_regno_mode_ok before setting lowest memory move cost for the mode with different reg classes. Date: Tue, 4 Apr 2023 13:13:46 +0800 Message-Id: <20230404051346.1223071-1-hongtao.liu@intel.com> X-Mailer: git-send-email 2.39.1.388.g2fc9e9ca3c MIME-Version: 1.0 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: liuhongt via Gcc-patches From: liuhongt Reply-To: liuhongt Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762221543641703823?= X-GMAIL-MSGID: =?utf-8?q?1762221543641703823?= There's a potential performance issue when backend returns some unreasonable value for the mode which can be never be allocate with reg class. Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,}. Ok for trunk(or GCC14 stage1)? gcc/ChangeLog: PR rtl-optimization/109351 * ira.cc (setup_class_subset_and_memory_move_costs): Check hard_regno_mode_ok before setting lowest memory move cost for the mode with different reg classes. --- gcc/ira.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/ira.cc b/gcc/ira.cc index 6c7f4901e4c..02dea5d49ee 100644 --- a/gcc/ira.cc +++ b/gcc/ira.cc @@ -588,6 +588,10 @@ setup_class_subset_and_memory_move_costs (void) /* Costs for NO_REGS are used in cost calculation on the 1st pass when the preferred register classes are not known yet. In this case we take the best scenario. */ + if (!targetm.hard_regno_mode_ok (ira_class_hard_regs[cl][0], + (machine_mode) mode)) + continue; + if (ira_memory_move_cost[mode][NO_REGS][0] > ira_memory_move_cost[mode][cl][0]) ira_max_memory_move_cost[mode][NO_REGS][0]