From patchwork Sun Dec 24 00:47:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans-Peter Nilsson X-Patchwork-Id: 183026 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp1925769dyi; Sat, 23 Dec 2023 16:47:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IHW3YMI86OgOaDKjBvWhett5PUxbWvmZuQ1Migft+zC5bzCBWlJq5c+XTpHADiQBD51VMC6 X-Received: by 2002:a05:622a:58d:b0:427:96be:c46 with SMTP id c13-20020a05622a058d00b0042796be0c46mr6801127qtb.50.1703378868016; Sat, 23 Dec 2023 16:47:48 -0800 (PST) ARC-Seal: i=3; a=rsa-sha256; t=1703378868; cv=pass; d=google.com; s=arc-20160816; b=YhgG2DWxnjpoTOWmSGA82tyjVgkpFgkzBYo5n3YZaQfZPhprVOLWPvOlr/QwpaV8d/ YSmTIhFV1SfATzTlvct4ntjEl+IrDa4172XDGtkrTQBNSxowgtcQdPjtOT+SAezNH6FC sk3x8uGhh4ntmZmBzAgsSqezSl3CXdfJ1NRDxCuOUxz9mYzVvWL7CNwNCV6KSd52mQxV Eo6jwJpyGpzCBtSJBT6oi34QcUzTz5ST2t864e5Tno7pppsa1WwDQmtKzvaZd+glBL0b 1ESHrUcXu16K20SpTk1LFLmm+d9H2z4Ab2XTFy2AAYmGBcfZCyeL5s/9k9T+Aorrq23p ibGQ== ARC-Message-Signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:date:message-id :content-transfer-encoding:mime-version:subject:to:from :dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=vgKYPjGIm7O6WwHJwG/Iv0rczVYe/SzJ+ZWgX4STrMs=; fh=gk9A5O7Gbglvz1MjrRQ4hZ2i3c68kYkpOZJg1emXh+g=; b=IbYkzw/h0idz13+im81U+OJO/EUTK8THnnRSXH/hIKjwf34+ceeHlC2gsLd3jBf0z+ dmG7KcP+9EKbuSG7f1fXFt3C6OwwEJx1q7mlp/A5PvcuTJ14+7QxsOy3S89li2aBaQXp Udot7PK2ClRk+D+pGcZ553I83UFmPNa88VhC0FO61LPzsrq8Zx+yb0HQ59cZKXpr40n3 RBzOZFiHr2c1YsM2gc9a99Omw3lhSGue3KnhP4A1kXyERSSosbIcm1qqW/jH4OA3/BF8 vFMBi+xBYl164foaaViDVOekVB68s1wINzZcRQfehwL+uoiYMvP2SCI8Dni7z+Q/GMfZ ho3A== ARC-Authentication-Results: i=3; mx.google.com; dkim=pass header.i=@axis.com header.s=selector1 header.b=YGoGCVJy; arc=pass (i=2); 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=axis.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id e17-20020ac85991000000b00427857d888fsi7621523qte.459.2023.12.23.16.47.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Dec 2023 16:47:47 -0800 (PST) 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=@axis.com header.s=selector1 header.b=YGoGCVJy; arc=pass (i=2); 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=axis.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BB7FF3858408 for ; Sun, 24 Dec 2023 00:47:47 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2049.outbound.protection.outlook.com [40.107.14.49]) by sourceware.org (Postfix) with ESMTPS id A1BDA3858C98 for ; Sun, 24 Dec 2023 00:47:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A1BDA3858C98 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=axis.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=axis.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A1BDA3858C98 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.14.49 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1703378843; cv=pass; b=qxYniS3jKcwXd2UsvGoGNCjYg5cllejWJrdeeYuI3wdGJqBdfsVkrAaefBeupxJP3oMhlbUyB2iqzi4ONxDXwEzq/m7gScjuJKp9vG9gho6fOjFz+LznrYDWU8NHXICXINwQeISf6g+hnZlYXPUNu7CJuKjkDSwpZbSHGsJGPuk= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1703378843; c=relaxed/simple; bh=uhpZbrAeeRjm5NmZ8QtulvE4lkYGohKWkzbPvPa+odU=; h=DKIM-Signature:From:To:Subject:MIME-Version:Message-ID:Date; b=et6GzTfUKwRwSW9IT+U+4GkSNnoIjo2LsD6dQ9gu1ROaP8Ox1iV1NQIulUPoIOvYouAK+OetCZJCU6p2AZhoiLdQSFcFkrHM0VKSeeqsHAiwVucCKCANlBQzl9v1VXvT89HcWIzGF4fNkflQWzxKWGuFKu1r43/tA6Kvi+7dm5Q= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=luZ0+WJuuIDABug/Le6V8aRxC/5Tu5EKbUpQzedGGjfwNXy2O/Osv+FkVAeAXfiJN2XvU4MmruvBbpAB+i6iBzUi7+bH0SoCPuNUr4j7HgMoEhk44DOMmvYQGpiWY1TrPVJ0HQnGXel0tTnfJRS6fbjf5nocgcYOoSFrs0PK2THJuvHSWuATM4jwfAIX2PX7zi2TFfxPm1e1ws2J0trOo8RAOxUdWEtzEGg4YYfSaI1tu7OWaPuwfj+bzZwJ/wxuSWrGlkkMOBfNenQZgZaYuQB+aCVSdpmBOMpc4UHGqn5idtr4dCgh1cN/iE/1V0zAIMFSxlvXS3CqCWt7zTp2fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vgKYPjGIm7O6WwHJwG/Iv0rczVYe/SzJ+ZWgX4STrMs=; b=KzAZE/dkcKM3vWElFQhO0Bi4ApQNTSEBUXznO1e4Zap3t7go7tnM1AD3czrMeFi9GxQ129j3gf+hA5gSXMtzH5lte8NXl9YqMzwnvbPZiQOoZOez4CnLpN60ICq8QDlsfKHXTrpgfqWwMqoJ/Aos8n2Hm6Kg+uA2oLLhOr9JD2oZXLUP7/62mEaRHH9aqibl+ZbebA/CbcOkQFWvG+GHTPUuk6pBokX9TLXsPIhoGSwuhSDGB8xK6kAw8xnrHOJbglqRdWD+57vFEZ+UY5tvjcVx/vMAKSS2FRsapvnO+OE2fgiioX+BbzxtfSQ6yN6dOZrQUFi/s870mnaPqIz/8g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 195.60.68.100) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=axis.com; dmarc=fail (p=none sp=none pct=100) action=none header.from=axis.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vgKYPjGIm7O6WwHJwG/Iv0rczVYe/SzJ+ZWgX4STrMs=; b=YGoGCVJyXf1bPtJNddZGaUALXtxWIinZ7WM/Sl62RZ+WOWvmaROQe+wOMU+3C0EgD9+KsCNMjGyV7hdkIeYGyAXWTDrWjJei1jHmSdwchEpGGCR3NAdU7PCNKWKH4JTLS8txDSKdES0VBcP1EhbgJj+0DqeaZgY3urJpvuUszyg= Received: from DUZPR01CA0107.eurprd01.prod.exchangelabs.com (2603:10a6:10:4bb::25) by DB3PR0202MB9249.eurprd02.prod.outlook.com (2603:10a6:10:429::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.24; Sun, 24 Dec 2023 00:47:18 +0000 Received: from DB1PEPF00039230.eurprd03.prod.outlook.com (2603:10a6:10:4bb:cafe::3a) by DUZPR01CA0107.outlook.office365.com (2603:10a6:10:4bb::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.24 via Frontend Transport; Sun, 24 Dec 2023 00:47:17 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 195.60.68.100) smtp.mailfrom=axis.com; dkim=none (message not signed) header.d=none;dmarc=fail action=none header.from=axis.com; Received-SPF: Fail (protection.outlook.com: domain of axis.com does not designate 195.60.68.100 as permitted sender) receiver=protection.outlook.com; client-ip=195.60.68.100; helo=mail.axis.com; Received: from mail.axis.com (195.60.68.100) by DB1PEPF00039230.mail.protection.outlook.com (10.167.8.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7135.14 via Frontend Transport; Sun, 24 Dec 2023 00:47:17 +0000 Received: from SE-MAIL21W.axis.com (10.20.40.16) by se-mail02w.axis.com (10.20.40.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Sun, 24 Dec 2023 01:47:16 +0100 Received: from se-mail02w.axis.com (10.20.40.8) by SE-MAIL21W.axis.com (10.20.40.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Sun, 24 Dec 2023 01:47:16 +0100 Received: from se-intmail01x.se.axis.com (10.0.5.60) by se-mail02w.axis.com (10.20.40.8) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Sun, 24 Dec 2023 01:47:16 +0100 Received: from pchp3.se.axis.com (pchp3.se.axis.com [10.88.21.53]) by se-intmail01x.se.axis.com (Postfix) with ESMTP id 719F810926; Sun, 24 Dec 2023 01:47:16 +0100 (CET) Received: by pchp3.se.axis.com (Postfix, from userid 171) id 6D2D62043F; Sun, 24 Dec 2023 01:47:16 +0100 (CET) From: Hans-Peter Nilsson To: Subject: [committed] CRIS: Fix PR middle-end/113109; "throw" failing MIME-Version: 1.0 Message-ID: <20231224004716.6D2D62043F@pchp3.se.axis.com> Date: Sun, 24 Dec 2023 01:47:16 +0100 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB1PEPF00039230:EE_|DB3PR0202MB9249:EE_ X-MS-Office365-Filtering-Correlation-Id: df9df8a1-bc79-4704-d172-08dc0419e0d9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VZxEtgKbVIZs29oOkFMzBeup4PQBT5SyvGlGxHgp1Ck+Q5HzPICNfvzuXh0obQowNZf6S/R9Rg+skMKPCbWvzNLUEVp9dg6cbBKnFObCHAJJ2Wwb4LXP3LMQcPp9YkNmrlFFkWMcWfZDtexcWT8eavvf07N2pvpdPxuri+QknTNOUSdqekdg6PQoJy6QbVMNRuhRDqIuqlTa5XnmIYmr0BJL0t46CnbS5VJEG7N2hzP13N+XI/JSsOTlscBqnoaF77BWvwHSWrDUfVQ50gmV3kzrUhTjNLQ2KgIlBMqymsMuE8wnNA5GPWeSKdEIC9HHO1ZGh+Q2DZDcoZRfaTZQd6ABBrvxKkbiCLlC6/qIYDxoWnesLUrXGgAyf6yQw93Wx1W+GQXXyGWAroPRCemFNTBBS5cK/iqmnGmgXB0dWf3cLJMBU1eg/YmYNS/zctR7EKXDc+MJxrJalDrXWg4d527fgMps49J93/Bpf1UzuodlzFqLfJiJQFtBQAe7fO29lhdBtSlPqatfRohouxljs2+51j3245K9Sc428xyOl5s1M3pEtolNkseT/17krPFD7hY2cWDkpCn7KSon7YWCFYrx7P5nH/RAhBM/+sPx5n6a255TV2rPLimjzVX9zYsG+7zWFf1Lhvtuzg19Xb26aOGueJU/78DuHpWkObRstYf7mKw64aF610+8xvitnCozYd6TUgjERcg33WZQfEPCi8ts+a/blp7dnVTN38kcqHJvFpBCmoCHFFs3RZgSkifQ X-Forefront-Antispam-Report: CIP:195.60.68.100; CTRY:SE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.axis.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(396003)(346002)(39850400004)(136003)(376002)(230922051799003)(1800799012)(64100799003)(451199024)(186009)(82310400011)(36840700001)(46966006)(316002)(42186006)(6916009)(2906002)(81166007)(40480700001)(70206006)(70586007)(5660300002)(478600001)(82740400003)(33656002)(8676002)(8936002)(36860700001)(356005)(6266002)(47076005)(336012)(426003)(41300700001)(26005)(1076003)(83380400001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2023 00:47:17.2207 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: df9df8a1-bc79-4704-d172-08dc0419e0d9 X-MS-Exchange-CrossTenant-Id: 78703d3c-b907-432f-b066-88f7af9ca3af X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=78703d3c-b907-432f-b066-88f7af9ca3af; Ip=[195.60.68.100]; Helo=[mail.axis.com] X-MS-Exchange-CrossTenant-AuthSource: DB1PEPF00039230.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0202MB9249 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1786122200083654909 X-GMAIL-MSGID: 1786122200083654909 No test-case, but the regress-367 from r14-6674-g4759383245ac97 is "back" to regress-10 for cris-elf+cris-sim with this patch applied to gcc from that revision. Also, I wonder why none of those other targets with a MEM for EH_RETURN_HANDLER_RTX with an address relative to frame_pointer_rtx (as opposed to hard_frame_pointer_rtx or virtual_incoming_args_rtx) don't see the same problem. Oh well. Merry Xmas. brgds, H-P -- >8 -- TL;DR: the "dse1" pass removed the eh-return-address store. The PA also marks its EH_RETURN_HANDLER_RTX as volatile, for the same reason, as does visum. See PR32769 - it's the same thing on PA. Conceptually, it's logical that stores to incoming args are optimized out on the return path or if no loads are seen - at least before epilogue expansion, when the subsequent load isn't seen in the RTL, as is the case for the "dse1" pass. I haven't looked into why this problem, that appeared for the PA already in 2007, was seen for CRIS only recently (with r14-6674-g4759383245ac97). PR middle-end/113109 * config/cris/cris.cc (cris_eh_return_handler_rtx): New function. * config/cris/cris-protos.h (cris_eh_return_handler_rtx): Prototype. * config/cris/cris.h (EH_RETURN_HANDLER_RTX): Redefine to call cris_eh_return_handler_rtx. --- gcc/config/cris/cris-protos.h | 1 + gcc/config/cris/cris.cc | 16 ++++++++++++++++ gcc/config/cris/cris.h | 3 +-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/gcc/config/cris/cris-protos.h b/gcc/config/cris/cris-protos.h index 666e04f9eeec..06678c723b56 100644 --- a/gcc/config/cris/cris-protos.h +++ b/gcc/config/cris/cris-protos.h @@ -28,6 +28,7 @@ extern bool cris_reload_address_legitimized (rtx, machine_mode, int, int, int); extern int cris_side_effect_mode_ok (enum rtx_code, rtx *, int, int, int, int, int); extern rtx cris_return_addr_rtx (int, rtx); +extern rtx cris_eh_return_handler_rtx (); extern rtx cris_split_movdx (rtx *); extern bool cris_base_p (const_rtx, bool); extern bool cris_base_or_autoincr_p (const_rtx, bool); diff --git a/gcc/config/cris/cris.cc b/gcc/config/cris/cris.cc index 7705c25ed6c0..38a4dd29114d 100644 --- a/gcc/config/cris/cris.cc +++ b/gcc/config/cris/cris.cc @@ -1382,6 +1382,22 @@ cris_return_addr_rtx (int count, rtx frameaddr ATTRIBUTE_UNUSED) : NULL_RTX; } +/* Setting the EH return return address is done by a *store* to a memory + address expressed as relative to "*incoming* args". That store will + be optimized away, unless the MEM is marked as volatile. N.B.: no + optimization opportunities are expected to be lost due to this hack; + __builtin_eh_return isn't called from elsewhere than the EH machinery + in libgcc. */ + +rtx +cris_eh_return_handler_rtx () +{ + rtx ret = cris_return_addr_rtx (0, NULL_RTX); + gcc_assert (MEM_P (ret)); + MEM_VOLATILE_P (ret) = true; + return ret; +} + /* Accessor used in cris.md:return because cfun->machine isn't available there. */ diff --git a/gcc/config/cris/cris.h b/gcc/config/cris/cris.h index 087b226ee475..ced356088302 100644 --- a/gcc/config/cris/cris.h +++ b/gcc/config/cris/cris.h @@ -551,8 +551,7 @@ enum reg_class #define CRIS_STACKADJ_REG CRIS_STRUCT_VALUE_REGNUM #define EH_RETURN_STACKADJ_RTX gen_rtx_REG (SImode, CRIS_STACKADJ_REG) -#define EH_RETURN_HANDLER_RTX \ - cris_return_addr_rtx (0, NULL) +#define EH_RETURN_HANDLER_RTX cris_eh_return_handler_rtx () #define INIT_EXPANDERS cris_init_expanders ()