From patchwork Sat Jan 13 15:43:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Coplan X-Patchwork-Id: 84043 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 937D73858C66 for ; Sat, 13 Jan 2024 15:44:27 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2042.outbound.protection.outlook.com [40.107.21.42]) by sourceware.org (Postfix) with ESMTPS id EC2FA385840E for ; Sat, 13 Jan 2024 15:43:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EC2FA385840E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org EC2FA385840E Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.21.42 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1705160620; cv=pass; b=uv0heXqmWQIKVRfnLr1D8hOqpRpkzpq7eOSoJLepVz0XFdWI1d+9xIUbTW8Ty1oRQLSjDRNnX5ndWGGhXbmkVOD34wxJoSlNl1dJ+OEdUJAWe9DY7S9jXJtchoOgR0WmkvfmKjLPwlHOgUAsJD2A1znUe4nhvCkSnvn0WGrQDyY= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1705160620; c=relaxed/simple; bh=/4cZwr93R274xWWZYBa0CjB7xC+pGyPWlN4ba4vWq7U=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:Message-ID: MIME-Version; b=JHQItGcBKQAvvDS60LjUnGcD69OQVA1nqmvLVWgsng12Oj+2/Fej/VzM5kCu0q7vosANFOQEK41gTwaKx0iQ02Wk/d3DWCFkxy9V/StWNQibpgILq/avH2vnKz/5keSp1pLOnPymLJncDfmasxxaVQQKd0t9FrAVNweanNh2CDs= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=UWtdCAdigeiVBp+GnM5mddwgYE+fzwtpouLmfIbWbaaVC6d/2yOLqtrQjfvNJ8WLHdr6+LDjpDV9i50jbRJnGW1sZeFoDub71c+lLTT2YL7Fpy0Tp0lrNdRhQ/ugV433qOlzPBEDFZgAjq9lRgGTuvpLW3xQ1wlg0Ha3Du84t1c0NgXPO/OdE230o/dUl1nbnOjK3AjE8DN+bbBQ4g/IgC744pp2jZwxS7M7y3E/E8JmR3jc4pfHpfraPPmteIkz6Ktr2uMDjnz7/csRfiLoe4wXfUaWXSLI2yTaqHhHqgsdf1JsBiZlz5XL2LSLoFmvt2ZECTRbsaljjgVaI23Bag== ARC-Message-Signature: i=2; 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=u+klHmv3VfUSxE5c159o/t76LVtZLeMcqqcnKTVujTs=; b=ZF1+wOc8KmR+ZmRON8VHF49Lpb/CL/Adb3UEcBHZrQgZW1MKUTI3q3Jx0ZkpT+6VyiPBFHmitx55iBRULaYRB8IMlGmEg7spb+vW9eYsGQ3CrzKgm5CBDgMOVpP1gKd7bclOJXhTt0X4T6tCC1mGObJM+LgOIXO88cLqCZUQTRUk4DbDWd2mzrKYCac+6pORyV8k8B3DB64/4SHBrrfolNSotIg2ELdMZEZEjak8hGPlMIdVl3Q02N9Yeg0pUDcG4XQKTy8qqQvUbrUGRvgSjqXIqAA+0jhCGq8O6FjQq0kLYTOJr2SkI310vDcu+2tMnXEW3We3L+jmVyoJpZWjEA== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=u+klHmv3VfUSxE5c159o/t76LVtZLeMcqqcnKTVujTs=; b=IdI0Oh4JGcGeKi1Y4XJGnPK/4Mj+Ft9/Irzr8Hu2ztskPisE0+iFuzWfvqmU268tsvxxKWHDpPPr1GQRkURdBaAmAFUchyyLG3R7nDQduA2xRrQuYZmErA6srMas9T4hCpNpW0K67KRgALxZUrobtL5IOlzC1TJcSjplz8EH5j0= Received: from AS9PR04CA0105.eurprd04.prod.outlook.com (2603:10a6:20b:50e::27) by AS8PR08MB8924.eurprd08.prod.outlook.com (2603:10a6:20b:5b2::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.23; Sat, 13 Jan 2024 15:43:35 +0000 Received: from AMS1EPF00000042.eurprd04.prod.outlook.com (2603:10a6:20b:50e:cafe::c9) by AS9PR04CA0105.outlook.office365.com (2603:10a6:20b:50e::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.23 via Frontend Transport; Sat, 13 Jan 2024 15:43:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AMS1EPF00000042.mail.protection.outlook.com (10.167.16.39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.14 via Frontend Transport; Sat, 13 Jan 2024 15:43:35 +0000 Received: ("Tessian outbound c4f080b252bb:v228"); Sat, 13 Jan 2024 15:43:34 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 6304edd8721fa18c X-CR-MTA-TID: 64aa7808 Received: from d5cf54e17e8f.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 3FDE728C-A9A7-4E01-BC08-C8D901555AF4.1; Sat, 13 Jan 2024 15:43:23 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id d5cf54e17e8f.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Sat, 13 Jan 2024 15:43:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EV3ZDMjvFHaOXa0F/ERQ621TaQOCSNk6rDzcJTkl6y7qMtOepgzhgKQkXj4vqfIPfIdQU0zKOTdEXQXNLV7rHnSg3NFgQnSTtLIPz03FJLuLMSq0RO5E5Jdi8rIgEYJvQp2bnpaAeJqljnT16qgubw1JMUN0qsOOfRCS3l9cFZi1hRKpcWx1GqGx4XLoSdn9qGVjdiuEzfE0gnx8ukiVZENrXn8XKzC3Fpin4r+OcPN6eflWU39SxSQBnvGiilcge1Zw9pjkolgIPZ088yoIV4uT4DMV32UPOsFBIbYrFH6X9kKciSB4GWt89oWCDP4FG0vTvXxl4hJOckYDkCDNSA== 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=u+klHmv3VfUSxE5c159o/t76LVtZLeMcqqcnKTVujTs=; b=Bdb3PdOOFWLxVSH+dO5x/4OjDULPlj05aK+5C7B38osDgy485N11SuqEFNdmAPHupIv5+OjMUN8wzraJCu347CcP9Hu0jOzSWgE3jyeAtjzP92PJU2MlEHe8UbLT+ajQG880vdxLNDhN/M0ppnJdLYYXa889vJdyJ2G0KLDAIdoWmdOWjC2Y4fx5Z2umGEwThwQneR7xv1IPQSdmWniuWzycBQDcntPWveR/c4kmpdPPO+1fEzzEmAEOuLoAJ1KRj8+382BQPA1aAzFwfaLZg7A0gefAOgOJjB1v8b4WFmxGur5YcHYwYdK3/bHKkR0rT4qYQjNYoC9PfqTK2Hmscg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=u+klHmv3VfUSxE5c159o/t76LVtZLeMcqqcnKTVujTs=; b=IdI0Oh4JGcGeKi1Y4XJGnPK/4Mj+Ft9/Irzr8Hu2ztskPisE0+iFuzWfvqmU268tsvxxKWHDpPPr1GQRkURdBaAmAFUchyyLG3R7nDQduA2xRrQuYZmErA6srMas9T4hCpNpW0K67KRgALxZUrobtL5IOlzC1TJcSjplz8EH5j0= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from PAWPR08MB8958.eurprd08.prod.outlook.com (2603:10a6:102:33e::15) by DB9PR08MB8484.eurprd08.prod.outlook.com (2603:10a6:10:3d4::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.23; Sat, 13 Jan 2024 15:43:21 +0000 Received: from PAWPR08MB8958.eurprd08.prod.outlook.com ([fe80::48ca:fbcb:84bf:ed17]) by PAWPR08MB8958.eurprd08.prod.outlook.com ([fe80::48ca:fbcb:84bf:ed17%4]) with mapi id 15.20.7181.015; Sat, 13 Jan 2024 15:43:21 +0000 Date: Sat, 13 Jan 2024 15:43:18 +0000 From: Alex Coplan To: gcc-patches@gcc.gnu.org Cc: Richard Sandiford , Kyrylo Tkachov , Richard Earnshaw Subject: [PATCH 1/4] rtl-ssa: Run finalize_new_accesses forwards [PR113070] Message-ID: Content-Disposition: inline X-ClientProxiedBy: LNXP265CA0064.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5d::28) To PAWPR08MB8958.eurprd08.prod.outlook.com (2603:10a6:102:33e::15) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: PAWPR08MB8958:EE_|DB9PR08MB8484:EE_|AMS1EPF00000042:EE_|AS8PR08MB8924:EE_ X-MS-Office365-Filtering-Correlation-Id: 31caedc5-d7b7-44c8-6fb9-08dc144e6746 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: cJmbHWY/RpnYD49ttRpi/7qrZlX3Wyc6gesIahzYe1ISlmxXJN8Qd+NGCjIi2MopZrtWvRx0gClsR71SGtj7jiFLor4CKci+sgRiu7uYc02Qz2iqZbtQNZ+QnhLootCIE/WMfH44EPxykVTUD7XyojcQKVCRbo59LfY5y+xaxFSDKth4G6sOY1jxLxzJ5X7RwWhv1T+HjsYN1cOeb7B7AXxAR8biHempjjkeBOHOTeNhi4wac9pY2p+neMfOLnI9TIP+YUNh/nCecsIIJgJBDwa7vserwItebPiwv60yQFbNZ9/Fo78RGEh5rO0Ods2GliqR4z2CP0wi1krtDarlcCqY8lebhYxmXT2RHrniLell9WafasBtJvKU9MoFV0ijv5JxsESJ60EgAQFimL5nW857fX8IeWjyAetAYDqpJFwp8koHLP5ahFSSe1idZCeqUICKD7+Ty2pVyg4tnLEULA5crpGIr4iSgs8k17xLvPqAJ7YLjcXFSSH3vUBEsT1cuy0J+zTdsrxIKU0w6W1FIqFnvOotQoQPc9T/Ic4prgWYL+wBBZC9Pm50y/OkBN2bkt1ZOBp3PJVJeUL6Z32mcxtCYAridzstUtts6fAczRa17HxyMJwuZDM0zwHIv6aH X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAWPR08MB8958.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(376002)(346002)(136003)(39860400002)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(86362001)(38100700002)(26005)(2616005)(36756003)(83380400001)(6512007)(6506007)(6666004)(316002)(6486002)(33964004)(44144004)(66946007)(54906003)(66556008)(66476007)(6916009)(2906002)(235185007)(44832011)(8676002)(5660300002)(4326008)(478600001)(8936002)(41300700001)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB8484 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AMS1EPF00000042.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: ce11cd96-9eb7-49bd-9645-08dc144e5f0d X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /HYf3XYI1/LmQR3LTvMk6+IYZzu0sKpyhVyS60zpAhJG/BlcADSzW1TOW5xC/VF6UfcW89tyeYPwkfjxZnxPpQnlzx6MWEjAZUc/XaYTpFi57gojEG5t1s6orjhfUOROF6N57w8fyFL5Vw2MCJjobXFNOoorp8rWc4QVua+ggbAFjes9nIemrs5CSWG+4Md0yAVxgR3Xl+Byg3GGXaYjS/D3Ed/dsqyl51oX9kw8G+IrxYoFQbnatHz8i/7me3P5vBRoSQ9KbEI4uB9vAoB2L+9n7qbJZiyH7RABVPjK2RxM6toMJ+116m9ufdJyIvunbdtr2WTYZqvGD4sIxg5t9Fgh2Lz+BsCOvEeH6JqH3TKGRWLtm0yZVaS9OWhYLvG14ovh45aXudGZPm6sE+ljaain8wNdszWdVWvPpfHcJEZR0YO2PXOEb6RQBTuSBw5K7jT9zFJcclOJIGRvbLyEV9qDdowAhr7kNBdaQnq23SiOEyQQmik3VOR5hEyBFCqSREvOoy1HFJyxrRLQ1fpaK0qnnLo41Wik1Xsy9BexHyIFiitK1y55M/hyp5ahpWhiU75ZKBXZPFNP7/ZGigXxdHSwjFMZyFyGVzkpwDHP6gPRmzkGkRzNALmUrJqgeVjn3C504R9LX/xZASznhNN9ovZyEXqQzgBITYmpZYkUw5dfi2X0JIDQsNn4WRJYqG1wFgMHd5BA7IDURuby/Stcs9paJyHPmtlNemDznJ7UzCYyUiTxai+SWcJH9q0yy35VRbF5qeDMURGRm957B5TnQg== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230031)(4636009)(396003)(39850400004)(346002)(136003)(376002)(230922051799003)(1800799012)(451199024)(64100799003)(186009)(82310400011)(46966006)(40470700004)(36840700001)(336012)(26005)(83380400001)(6666004)(6512007)(33964004)(6506007)(44144004)(2616005)(70206006)(36860700001)(82740400003)(47076005)(44832011)(235185007)(4326008)(5660300002)(41300700001)(6486002)(2906002)(478600001)(316002)(8676002)(8936002)(54906003)(70586007)(6916009)(86362001)(36756003)(81166007)(356005)(40480700001)(40460700003)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jan 2024 15:43:35.1973 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 31caedc5-d7b7-44c8-6fb9-08dc144e6746 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AMS1EPF00000042.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8924 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY 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+patchwork=sourceware.org@gcc.gnu.org The next patch in this series exposes an interface for creating new uses in RTL-SSA. The intent is that new user-created uses can consume new user-created defs in the same change group. This is so that we can correctly update uses of memory when inserting a new store pair insn in the aarch64 load/store pair fusion pass (the affected uses need to consume the new store pair insn). As it stands, finalize_new_accesses is called as part of the backwards insn placement loop within change_insns, but if we want new uses to be able to depend on new defs in the same change group, we need finalize_new_accesses to be called on earlier insns first. This is so that when we process temporary uses and turn them into permanent uses, we can follow the last_def link on the temporary def to ensure we end up with a permanent use consuming a permanent def. Bootstrapped/regtested on aarch64-linux-gnu, OK for trunk? Thanks, Alex gcc/ChangeLog: PR target/113070 * rtl-ssa/changes.cc (function_info::change_insns): Split out the call to finalize_new_accesses from the backwards placement loop, run it forwards in a separate loop. --- gcc/rtl-ssa/changes.cc | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/gcc/rtl-ssa/changes.cc b/gcc/rtl-ssa/changes.cc index 2fac45ae885..e538b637848 100644 --- a/gcc/rtl-ssa/changes.cc +++ b/gcc/rtl-ssa/changes.cc @@ -775,15 +775,26 @@ function_info::change_insns (array_slice changes) placeholder = add_placeholder_after (after); following_insn = placeholder; } - - // Finalize the new list of accesses for the change. Don't install - // them yet, so that we still have access to the old lists below. - finalize_new_accesses (change, - placeholder ? placeholder : insn); } placeholders[i] = placeholder; } + // Finalize the new list of accesses for each change. Don't install them yet, + // so that we still have access to the old lists below. + // + // Note that we do this forwards instead of in the backwards loop above so + // that any new defs being inserted are processed before new uses of those + // defs, so that the (initially) temporary uses referring to temporary defs + // can be easily updated to become permanent uses referring to permanent defs. + for (unsigned i = 0; i < changes.size (); i++) + { + insn_change &change = *changes[i]; + insn_info *placeholder = placeholders[i]; + if (!change.is_deletion ()) + finalize_new_accesses (change, + placeholder ? placeholder : change.insn ()); + } + // Remove all definitions that are no longer needed. After the above, // the only uses of such definitions should be dead phis and now-redundant // live-out uses.