From patchwork Thu May 25 12:35:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manolis Tsamis X-Patchwork-Id: 70071 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 38F573858D3C for ; Thu, 25 May 2023 12:36:43 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by sourceware.org (Postfix) with ESMTPS id 986E2385842C for ; Thu, 25 May 2023 12:36:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 986E2385842C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=vrull.eu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=vrull.eu Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2af290cf9b7so5199621fa.3 for ; Thu, 25 May 2023 05:36:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vrull.eu; s=google; t=1685018184; x=1687610184; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jn7HuYfKmeBSp4cDidN65NXPyZM0y1O5sBkz3BSSGKA=; b=n9B9YiwpsApnUAVhNSTtocy7zNYf3moQTUKgsxVTpkJSr1wejMbyqE2aPDl0j2n3a7 bQZtKoAqqMBun7ovYAWoX857sTgG2mxYiF+Vfeiju0iShKqpGLCRUmsG037cAdlhWrx2 PNrGOh6epoydciPSr92CfXlEYe8k7AXCGU20+GS2NvWkTBnVszd7CJ3j7eWYdNGgEtfo j00w0rZck1GJbfcJi24uNXDjzPArFUnm9FyFMmn6nTn6hx8Fya5oz5GZyC6jmxbiaQYL JB6JTLDNsRQq79STit1Z6k/TzbyyagdZj8ZesQnKnfogBoxYKJ2peH9gcqGNDYSEQdbI 2Oqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685018184; x=1687610184; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jn7HuYfKmeBSp4cDidN65NXPyZM0y1O5sBkz3BSSGKA=; b=csMYe6oxc4RkpoiMgTxn3S4f3GgxnlIsZHzoj4TOdYrooVG7psTyOhoevH2zbbnnyO Iiygntoaon0XsUXbQES646ryFtoKUjJQIyM+nqc6ezmr9kbxSzhOZQAFkG5kGYUfuG+7 jofLNoF9Gnyxi5GGEnVt/Aup9d/+X+v1N8cT6I/f+/Y7ugN10aBweQE7mdMJ217wK/qU AUxFs1iNZBfw4fgsOTz3mU+G3Qt80btqxN8d2J+z2mO5ek8nBi2f7Yx5pkDpm0180UW7 1+6FS06FWwWf63/bzo32I8f1nQ6qXKbbE8M+Sb/mkWr31nACEnd1NjymmwRaidIRWLet o/JQ== X-Gm-Message-State: AC+VfDxgtyDM0ZsAg+qz8ohnVMr2S0C+FRzpYSaIOc92zAkNX6zzgCUZ DlzzodK86pjjAji/32Y1vDzowGTFMxlswiGL9L93pQ== X-Google-Smtp-Source: ACHHUZ4GmVkgwZ3HIc5SHDYyP+N1GI947tq78Z5l32eFfmcSX84Rbcs8Zl8WUsY+fMwClRBQkZb/NA== X-Received: by 2002:a2e:9187:0:b0:2ac:83bb:ab46 with SMTP id f7-20020a2e9187000000b002ac83bbab46mr957585ljg.30.1685018183905; Thu, 25 May 2023 05:36:23 -0700 (PDT) Received: from helsinki-03.engr ([2a01:4f9:6b:2a47::2]) by smtp.gmail.com with ESMTPSA id l7-20020a2eb687000000b002a774fb7923sm236631ljo.45.2023.05.25.05.36.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 05:36:23 -0700 (PDT) From: Manolis Tsamis To: gcc-patches@gcc.gnu.org Cc: Richard Biener , Palmer Dabbelt , Philipp Tomsich , Kito Cheng , Manolis Tsamis Subject: [PATCH 2/2] cprop_hardreg: Enable propagation of the stack pointer if possible. Date: Thu, 25 May 2023 14:35:51 +0200 Message-Id: <20230525123550.1072506-3-manolis.tsamis@vrull.eu> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230525123550.1072506-1-manolis.tsamis@vrull.eu> References: <20230525123550.1072506-1-manolis.tsamis@vrull.eu> MIME-Version: 1.0 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Propagation of the stack pointer in cprop_hardreg is currenty forbidden in all cases, due to maybe_mode_change returning NULL. Relax this restriction and allow propagation when no mode change is requested. gcc/ChangeLog: * regcprop.cc (maybe_mode_change): Enable stack pointer propagation. Signed-off-by: Manolis Tsamis --- gcc/regcprop.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/regcprop.cc b/gcc/regcprop.cc index f426f4fedcd..6cbfadb181f 100644 --- a/gcc/regcprop.cc +++ b/gcc/regcprop.cc @@ -422,7 +422,12 @@ maybe_mode_change (machine_mode orig_mode, machine_mode copy_mode, It's unclear if we need to do the same for other special registers. */ if (regno == STACK_POINTER_REGNUM) - return NULL_RTX; + { + if (orig_mode == new_mode) + return stack_pointer_rtx; + else + return NULL_RTX; + } if (orig_mode == new_mode) return gen_raw_REG (new_mode, regno);