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. From patchwork Sat Jan 13 15:44: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: 84044 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 141193858429 for ; Sat, 13 Jan 2024 15:45:04 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2056.outbound.protection.outlook.com [40.107.20.56]) by sourceware.org (Postfix) with ESMTPS id 528D53858C29 for ; Sat, 13 Jan 2024 15:44:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 528D53858C29 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 528D53858C29 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.20.56 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1705160675; cv=pass; b=kTTi19PBdCovFqUmNbs2umv1VaPHlON0ovEub/MO0FJZegXYlrHaQzEWyUZmzZGS37/Z2XIUsYSchhctjU3J/Ccj1apR32BphJidizsjPDFErejumuvC4/ex7Rjs9lmsiwlQtfX+pXyIlcrDXhsUpGe0WuurZ9elCppjm85EUaY= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1705160675; c=relaxed/simple; bh=D5qi9ELvFGc7S2lKhjjnwkAQSakny6L6NeZ9jF/edws=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:Message-ID: MIME-Version; b=S4CA7UzTnKTBH1mG+UpiUzWWbtT1CmxroAIPF6IV4sWyLjuougxPSZ/n1z7gRNLnadvF7x5WDun9ZfR5iSyluI6RC+cg8r3TjjpGIUl6ixju4782QOZjYJwZtFY1J2MpZ2vvNxf/mRl38OysLulZ1myhq9BsudADMy2OIqALjfk= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=Zeft4DwkLR/glW1YAllvFiNMZ5YwEvlsXASxgRDaOVSg75/7+dJ1vn2eFPiIq9PeL7OqpghaHKDvdZbAwPEhmQR8bu3AQIR+mZr26kbBY+bMJfXEMeaNKiq0pL17/bCduWTYpCZVJRFkTj7sKB4OPBzyMw1SrB6Yo53tlrN1L7rHx8201Fmiuiv7og8HNljbq5SgIzAQAd8X5dOjiC6resX5MD/nwmid3QENkRNVmg/iVA5fpfn3uLEJO/yqR0rcwN2CJFziDzM8FPiZ8QVrqTqSZRdtpyq9ul9bHZ3IF0jFGOuaJa1GAjVWZEQeKr4K8gOki7D37qd1iGuNumJWzg== 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=/QxFs7AYJS/LbVMrjskh4R3XVQsQmf37RrknxGMvFao=; b=CvmdJNaADwUCwxYkuimQjbBxyV9Gy+IFIoz6cKQj3hvPWRbsth/Yb1EQoQWf7qsXARKVCxLIHExCZ8X1Rp/ecya3+MwIbqWW/OuU2nrc7psrG4UD358ycTk4RxFzX27vcKB9rXCmAbrfCd0YNmtgYk5HKunwwDOX7BfTn7t0Oee7B+La47anwSlUybzRffBHiwI5BlTEJRgFI0licL5sQffwDqBvAb4tGuTqjn/I1RQmTC9bl9eQrFANcftQWoKrGq2AQrAgoIpiEfegfOzQvAzzWeM0Sf6OSUMiO5Vd4KOMzlx49LxGZdbFVrvdywdejq0dtKbpFbzu/y0yM0rhKw== 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=/QxFs7AYJS/LbVMrjskh4R3XVQsQmf37RrknxGMvFao=; b=z+AeGtHureCmfsSxH3HncGZqLi/2uBANQMQ7vJOGVd8r6wGKPXfyP2Pnj735cswbdGy+ERExApSXTgRDKYwW+cBrqOD58eR+zkZHMMFpe6+ozT1/e8zRznv4MW7IGeIstRF76chqtLNtDBnWgz6WejX0EwCJ+T0vJz2XNNWEeJ8= Received: from AS9P194CA0011.EURP194.PROD.OUTLOOK.COM (2603:10a6:20b:46d::16) by PR3PR08MB5708.eurprd08.prod.outlook.com (2603:10a6:102:84::9) 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:44:29 +0000 Received: from AM3PEPF0000A791.eurprd04.prod.outlook.com (2603:10a6:20b:46d:cafe::d4) by AS9P194CA0011.outlook.office365.com (2603:10a6:20b:46d::16) 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:44:29 +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 AM3PEPF0000A791.mail.protection.outlook.com (10.167.16.120) 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:44:29 +0000 Received: ("Tessian outbound 1076c872ecc6:v228"); Sat, 13 Jan 2024 15:44:29 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 8daea96fdb55cd46 X-CR-MTA-TID: 64aa7808 Received: from 4edc99f96549.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 7DA4F0D3-1F66-4400-B41E-95C468305C17.1; Sat, 13 Jan 2024 15:44:23 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 4edc99f96549.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Sat, 13 Jan 2024 15:44:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VrrnedJ4BeNxKUZ0aybJJodgy9zqLuYk/C0nUroPad7tQ0tlk+nvzOmHkAGE/dJshNL5qKJLimCBzL8SzLqiSMsxG23L8g3BMyrtcyjKyBvc0m/acFOXTr0FYOGpainSoGHOQ0PiE0N/JmPu49QF8a6KZF6vs8wsSZeYrLOty2cah6Pi+d0s0opCqMkhKHohe92C5GE8yikfEmVvgpa2welnZPKv9CETOd6iY9EeCNI9nRDvyKYMFik2ytVCi8nYPboJw4rgVeSguHnEd6eDpTW588w0Z2auejvEt0MNRC6HY51nrfO3zPE0+CmOMsAqf8h+3jHtY3gt49b3rJkATA== 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=/QxFs7AYJS/LbVMrjskh4R3XVQsQmf37RrknxGMvFao=; b=kzQLf62k3rLUa6xJXRWkFg1J4B2yo6twdI1NLPGKbGPpfhDjrLFkrZHA0WFd/bE+abXWd9aFKFpJxks4VxwrTbmfhMr6zmw/ECo6Bsgg6gadyBApmtoUPXnVtLqZCfQZDqniL5DtShXJZeZTtKPrlRZONVhvsCGrnC5RWYv/4tF/JtHaBoOhVEjahtYoWXwmB5aMkWcttdbksaPgomC0Ob2qMXrbF0TlAsZJP0W9eMTXrTUnw3StZncDpK6XGL4dAiW7poYEUI+0xJJgJUTXSePqZobGfP+Ki90GFqetFfI3vktu8RyCqCJCgV3udTNfGD5NgxIxA0/T8LcJ+rEWhA== 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=/QxFs7AYJS/LbVMrjskh4R3XVQsQmf37RrknxGMvFao=; b=z+AeGtHureCmfsSxH3HncGZqLi/2uBANQMQ7vJOGVd8r6wGKPXfyP2Pnj735cswbdGy+ERExApSXTgRDKYwW+cBrqOD58eR+zkZHMMFpe6+ozT1/e8zRznv4MW7IGeIstRF76chqtLNtDBnWgz6WejX0EwCJ+T0vJz2XNNWEeJ8= 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:44: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:44:21 +0000 Date: Sat, 13 Jan 2024 15:44:18 +0000 From: Alex Coplan To: gcc-patches@gcc.gnu.org Cc: Richard Sandiford , Kyrylo Tkachov , Richard Earnshaw Subject: [PATCH 2/4] rtl-ssa: Support for creating new uses [PR113070] Message-ID: Content-Disposition: inline X-ClientProxiedBy: LO4P123CA0424.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18b::15) To PAWPR08MB8958.eurprd08.prod.outlook.com (2603:10a6:102:33e::15) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: PAWPR08MB8958:EE_|DB9PR08MB8484:EE_|AM3PEPF0000A791:EE_|PR3PR08MB5708:EE_ X-MS-Office365-Filtering-Correlation-Id: 459a5f07-5a56-4642-66a9-08dc144e87a8 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: F4hIU4+AC3YV/k/jDkinGysnJgSbNBz0G9sa1zkUfVWO3+l8X+wucuXIUSxeN5a8FTYcDBwny6wHp4zDpxJ3uQwZawQgnRrKgUCNy+uH8Ph3/qrgfH0MylVDgwEQO6lZ31Ya23IT2uq2DTpRQ+x7VNWVHkFV+I9eNwpgQXxsscXINhuUMGgZ78xDn/AbGlsKOFxtV4rnqLZoWxzfE0kQYwp3MXx5dDsOXYmNH0BMleZMawxyMCIdJ8DajZfTHUabBPSmz/I/y1bP8hO49qEY83Nyzt7e4XtUeK2ShhQg3coFAK+7Xg4x9YYpVP8NNdUDGlYAZbELPj6ed1hqGHsgTJL3Hd5/ObEk4KHiQQ1LgSH6hAz1zemP9BWdvD5JscXkpvsEKVeFrVqdTFrXRm9Hhih9FrW9dzojI+K6XspRMlAxghj1KZJp7y3NwcvI5L7/T5AdHKjjLE8i0hcBlcDx6RRyiJYcV+QyxFXNrokG3jJ8i3Yv+7VMW300xkHXVXJ3Il0k9CKnURkxZHkrRzUQvJwRGBzy7blsSYJ2UShIVFmnZdQQoE/XTUDtKifnpeE2cMtgQaq5UJsg5ZrTkfjyWrXMsOmdFDhoNqMxwgQst9aWj6t3FG6uGtB/+Jcc1o+5 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: AM3PEPF0000A791.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 99732efe-1d2c-4a74-d05c-08dc144e8307 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: T4n96kxHurZZ0JYl8LqAS5ST1MaOexln++6oTjM0WcqE23V6ceIUA6I3NHXBh03R0/IAw87aSkCEZX7aWOc5Mm64nnVhKcDbD5Xi/d+kNomSVvS7m88ODYiKo8v19ervkQ4O+Nf8DX6BDGoCa33mZEvD9B22utOXt2G9bJx2wC36Ql+ypuLlChjXG4ubObLQkwrEaOFFEQaYAv/1ugM06jzJiMYErD+8Srk0vtWwWurIaMuj9bxmw68sFdHfvg28afdKHSz53trejpQZdiFla0otBpCAXbWryPROuFNypyUljkOBfK/+5l9hzWgMtHCaqBEA2TokB9KsIGtCaEwFvFV/gwpHKW7g/KsWAt01RxBGEYrUFHsjZXOxeqlKMg8KXzVBOhGgF91LU229LBn3e41mLLg0W1qbLI7YZE/Z88xug3d2/KkPnbCVeaHhfdxo1qx8e7OFsYm3GNUVuOpGZcdSCsMyPcEbx5tvUtHN/C1trN3NHz0CSLM6PM0ZQRXB0thywHh3B8QilKC0HX8Ot+id/krDfENYgAyW1zUWpfwpZR9eqiRmRDuAQuK75JnfGixkcQFPDPYZjjF+msFZQOuLSMC0Uc38G1/4XF0AN2JZktekwQ+c/UY8x6Y2DYGLqhm4mZ2Wo1cmVJvQT1gDFafETEq369cGmmN93iIyNXJ/QWXKj6lNvK6+xwg+u95MWkhi7cW0fFkyTZMQnouS4g56O0MQpyrtivs/323FQih3+P4QKecLECeXla+GCeS6kiCaNU3fbZTfYy35wKOsAg== 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)(39850400004)(136003)(396003)(376002)(346002)(230922051799003)(82310400011)(186009)(1800799012)(64100799003)(451199024)(46966006)(36840700001)(40470700004)(33964004)(44144004)(26005)(336012)(478600001)(6486002)(6506007)(6512007)(6666004)(2616005)(47076005)(83380400001)(2906002)(5660300002)(235185007)(41300700001)(70206006)(70586007)(54906003)(316002)(6916009)(44832011)(4326008)(8676002)(8936002)(82740400003)(36860700001)(86362001)(36756003)(81166007)(356005)(40480700001)(40460700003)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jan 2024 15:44:29.5264 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 459a5f07-5a56-4642-66a9-08dc144e87a8 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: AM3PEPF0000A791.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR08MB5708 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 This exposes an interface for users to create new uses in RTL-SSA. This is needed for updating uses after inserting a new store pair insn in the aarch64 load/store pair fusion pass. gcc/ChangeLog: PR target/113070 * rtl-ssa/accesses.cc (function_info::create_use): New. * rtl-ssa/changes.cc (function_info::finalize_new_accesses): Handle temporary uses, ensure new uses end up referring to permanent defs. * rtl-ssa/functions.h (function_info::create_use): Declare. --- gcc/rtl-ssa/accesses.cc | 10 ++++++++++ gcc/rtl-ssa/changes.cc | 24 +++++++++++++++++++----- gcc/rtl-ssa/functions.h | 5 +++++ 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/gcc/rtl-ssa/accesses.cc b/gcc/rtl-ssa/accesses.cc index ce4a8b8dc00..3f1304fc5bf 100644 --- a/gcc/rtl-ssa/accesses.cc +++ b/gcc/rtl-ssa/accesses.cc @@ -1466,6 +1466,16 @@ function_info::create_set (obstack_watermark &watermark, return set; } +use_info * +function_info::create_use (obstack_watermark &watermark, + insn_info *insn, + set_info *set) +{ + auto use = change_alloc (watermark, insn, set->resource (), set); + use->m_is_temp = true; + return use; +} + // Return true if ACCESS1 can represent ACCESS2 and if ACCESS2 can // represent ACCESS1. static bool diff --git a/gcc/rtl-ssa/changes.cc b/gcc/rtl-ssa/changes.cc index e538b637848..ce51d6ccd8d 100644 --- a/gcc/rtl-ssa/changes.cc +++ b/gcc/rtl-ssa/changes.cc @@ -538,7 +538,9 @@ function_info::finalize_new_accesses (insn_change &change, insn_info *pos) unsigned int i = 0; for (use_info *use : change.new_uses) { - if (!use->m_has_been_superceded) + if (use->m_is_temp) + use->m_has_been_superceded = true; + else if (!use->m_has_been_superceded) { use = allocate_temp (insn, use->resource (), use->def ()); use->m_has_been_superceded = true; @@ -609,15 +611,27 @@ function_info::finalize_new_accesses (insn_change &change, insn_info *pos) m_temp_uses[i] = use = allocate (*use); use->m_is_temp = false; set_info *def = use->def (); - // Handle cases in which the value was previously not used - // within the block. - if (def && def->m_is_temp) + if (!def || !def->m_is_temp) + continue; + + if (auto phi = dyn_cast (def)) { - phi_info *phi = as_a (def); + // Handle cases in which the value was previously not used + // within the block. gcc_assert (phi->is_degenerate ()); phi = create_degenerate_phi (phi->ebb (), phi->input_value (0)); use->set_def (phi); } + else + { + // The temporary def may also be a set added with this change, in + // which case the permanent set is stored in the last_def link, + // and we need to update the use to refer to the permanent set. + gcc_assert (is_a (def)); + auto perm_set = as_a (def->last_def ()); + gcc_assert (!perm_set->is_temporary ()); + use->set_def (perm_set); + } } } diff --git a/gcc/rtl-ssa/functions.h b/gcc/rtl-ssa/functions.h index 58d0b50ea83..962180e27d6 100644 --- a/gcc/rtl-ssa/functions.h +++ b/gcc/rtl-ssa/functions.h @@ -73,6 +73,11 @@ public: insn_info *insn, resource_info resource); + // Create a temporary use. + use_info *create_use (obstack_watermark &watermark, + insn_info *insn, + set_info *set); + // Create a temporary insn with code INSN_CODE and pattern PAT. insn_info *create_insn (obstack_watermark &watermark, rtx_code insn_code, From patchwork Sat Jan 13 15:45:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Coplan X-Patchwork-Id: 84045 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 969FC3858418 for ; Sat, 13 Jan 2024 15:45:58 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2085.outbound.protection.outlook.com [40.107.8.85]) by sourceware.org (Postfix) with ESMTPS id 4EA513858C29 for ; Sat, 13 Jan 2024 15:45:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4EA513858C29 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 4EA513858C29 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.8.85 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1705160734; cv=pass; b=FmPwVUJ8S2oSyrTNqIhuhI0tXYTipD2MAl2Kk09OwlQ2y51fhEmTfQrs1bSZGrRZ7e+LkQzAhZHk+LibyD3XC/yZRGhVY7HLAKqjGNo7d+mVf+CZ89AylkxoRWty3fiiEx/hLzYisG0v7hVcO2TIopvjtduVnnKDVnHz4Imf/kY= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1705160734; c=relaxed/simple; bh=ZVix3B6UeyBuojOMU07eFSrUcx4EQc/VY+6MXo0UOgU=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:Message-ID: MIME-Version; b=wMscTqmHkCR9939/6tjB3fh0umzs4wY9EJI5xVCzl3UbaNhsSHYhZLEipKyvcm15n03tJ2y1D8EmlOawZ1/b1suDfHMLbpVzy0HmH3PZ3pBgFP7+Smy43xWPTsI6dSPjihrxwCQX/CYG5sTfJ+BTR7gdAi0yE6ohe1tfFBil53g= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=FsPI94/xqiZHphpE/BcL6mfUukJoOBpXPA8q8na7gKHmjsYgqHnOaCyRo6DWA5V26jG/pcFzUhjd3TnCx81jqASqVMqnJL9vZVzFWJwMA/8Y6x6FzN7CnaQ8rob9r6eDhmFoFW73rZVL/jq42rRjq3VFZK+KF0Ss7isxzyrjXWX+qOVA/9xorgGEi51gWQziIYqIjQJ01QX14o6ZP7dXnGLoK/HCbnYKEM1bhMsjjouNvo85f9q3pKwDuH0XYp+B+747tN/UiM6o2MoNhulqMgrQtKU67KjeM84zitsP2a7h7cByM4dvAztrmsyXOTs5k/2ec79Wd3jqNpo/rlKiyw== 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=Ffnkxrkl862jiy8xABWl6Odrq+oKbWfUPuZ/e1jqY6I=; b=ha8CdW2gMqoEfQ4W5Ct4WK5w5443GNqWQjcAqO0jGWzx5J09Mfghu7P9TZz29CujG1CCj4zF72ATUuLZKvmD1xxhFMSYWrOob6Tf3cryXy5xtGSPwVaa4SEIniMCowwAaSQQMR42liTGY0wFuQBc6spwh/lypJa+7DbDdSK6Chp92Q/OB9FQDDGlK7zF19wCEHwoa3o1+O1wSv/Zsxi0zJQVfKprK65fYM1lDp0S9s5GxmF4YKyt24JEbI3nNZpfo0zlO1igrRPKaOv9R/d3Zibd/b1Ut27H6OaKBABoai2yCmzSfT6E1fkUcWfRjGX6ywPaioO4Jd8pmnE+fIPc9A== 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=Ffnkxrkl862jiy8xABWl6Odrq+oKbWfUPuZ/e1jqY6I=; b=goKSjM18fedbBfsJclF4W7GL4fecQpJeqHB4dZJC/Yn9+xFTqDpqLT1MLnyw3JA1qmcP5nnTj8Ho+0/2TsusSRLs2gmiezfi1G2Q8kdun8zJmeC7SD0XTJaO6oN8fKO5htsDvDf7MahmbUzsvuzGB6RYJ277c9jxISXU2fKhKA4= Received: from AM6PR04CA0050.eurprd04.prod.outlook.com (2603:10a6:20b:f0::27) by AM8PR08MB6372.eurprd08.prod.outlook.com (2603:10a6:20b:369::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:45:26 +0000 Received: from AM3PEPF00009BA0.eurprd04.prod.outlook.com (2603:10a6:20b:f0:cafe::80) by AM6PR04CA0050.outlook.office365.com (2603:10a6:20b:f0::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.21 via Frontend Transport; Sat, 13 Jan 2024 15:45:26 +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 AM3PEPF00009BA0.mail.protection.outlook.com (10.167.16.25) 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:45:26 +0000 Received: ("Tessian outbound 31df1b57f90c:v228"); Sat, 13 Jan 2024 15:45:26 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 457cdd9b36aeeb40 X-CR-MTA-TID: 64aa7808 Received: from cccf462281f0.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 31E1F29E-4ABB-4861-9BDC-A7DE3564C25E.1; Sat, 13 Jan 2024 15:45:19 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id cccf462281f0.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Sat, 13 Jan 2024 15:45:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VIEHX1LmItkLF4QQ71S0NOtyY7Kc+hKZ5tXf/nWRqWwDP+HZYRFuzwP/iA59+MuqJDhVnVRd4gjKxcUdcXkX9c/Z32M68tb+dC59VjfDH7vXcpYvRI99S5+KtMbg/DvN0T8pCwG3D7MMLwkaTcUiqVpc4k5Hl05DKLigDtzn18BIczfGjyBM96YTYjg2hll2Ly6YzRO6iDvEtwMLOgbQSVRCGCo5wrqBD6YX7Ytj8QUbn4ts9y16duTr3Exb1hwevOQY56QSU8mqtqKMGUwWm+cFyMxw8phRWgExYQw8+TKNi8noMSzvowuQBy6pEpWwE5W5s3BtYfMxlaKHZRGvOQ== 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=Ffnkxrkl862jiy8xABWl6Odrq+oKbWfUPuZ/e1jqY6I=; b=ZxyR4DylHMIYx5uz7DdQ1K913xWFyb2lBW0ctqGExJihP1ZrYevEZJD1JQgkwKmLUl7YfAD3j4rvy/OAl9qAmXevPevL3Yb4A31xBebxYd+U5O3oFIymYD5ZT438a3crTHQJeAnlI7RBRRZ4OKcYnQsAIljWzWUKhYvxmLeF2JtaAKS6gM3lunDs4O0XfPlP6HeGigKgaQEdKSFLAKUYtR4xjiZ6sWn+DM9S5/VnIeXb8nuJm7eaYYmyRS12aankEtIiT54TbrgRWHVrBJpKgEPizpz3E24EMmorkDoKJ5cGJUFohgIehsJwtFTlXYk+FrGYPBoie7+XBizRDWaDWQ== 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=Ffnkxrkl862jiy8xABWl6Odrq+oKbWfUPuZ/e1jqY6I=; b=goKSjM18fedbBfsJclF4W7GL4fecQpJeqHB4dZJC/Yn9+xFTqDpqLT1MLnyw3JA1qmcP5nnTj8Ho+0/2TsusSRLs2gmiezfi1G2Q8kdun8zJmeC7SD0XTJaO6oN8fKO5htsDvDf7MahmbUzsvuzGB6RYJ277c9jxISXU2fKhKA4= 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:45:16 +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:45:16 +0000 Date: Sat, 13 Jan 2024 15:45:12 +0000 From: Alex Coplan To: gcc-patches@gcc.gnu.org Cc: Richard Sandiford , Kyrylo Tkachov , Richard Earnshaw Subject: [PATCH 3/4] rtl-ssa: Ensure new defs get inserted [PR113070] Message-ID: Content-Disposition: inline X-ClientProxiedBy: LO4P123CA0119.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:192::16) To PAWPR08MB8958.eurprd08.prod.outlook.com (2603:10a6:102:33e::15) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: PAWPR08MB8958:EE_|DB9PR08MB8484:EE_|AM3PEPF00009BA0:EE_|AM8PR08MB6372:EE_ X-MS-Office365-Filtering-Correlation-Id: c94c74de-1fd9-4b70-a99c-08dc144ea97d 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: JF86OLjn+rXONQgdcAT+D1/x2H/4ekBCrCft3M0kQstqMfEfeWvCmvwFe5CSMfugUKZWl8ST2sCxEpWdYptOWfRnMoI5kPbLowitlsGCev44B6uERAn675Ok7gBE9/bmFWtdYQfRT576AYc+vk8h3x6huRFm4FTUaQZozS7ohSDphA1OTOINbAC0hvPuYBj+tRQ2JT5sCzKfDh0kORaqTGZB9sTlHQ/O28EAIoV7HnvZOwhyuC0u8sg4vVDrtk1II0EYOp3uNG4OrxSw6pmFZLWFD/RECshwmInQ1YsQabWr8XYnvnobgLmO7C58mqh3JbJqKDFGNWIHuiH9tu9rMn1YYCucuEIRd9WP5Lgvu+IzTaJx2GnVEXNfAFa39VQW3R3ak8OSjEoidGjVYww0LnTZCNylA4qq1r5GJkisImhJExX1gVvSXLjxcu4zDv2Z2m0G0Mcctn14cvs7jcDSXUeChiVksAdogI6TPT96tLHNbywS+oiFIzzfZ4o++ihwXAXbhJrOPISY1bbHU6SatA9HwBPyplCdc9SVey3mzs9nDmqan/CqfLXZlPJXtffPBIN4tpMnYFpYWLLtu/1nGWy6yFUQ4u0GgcIw1z1nMJM0Sw0vkIKtexGmE0I/WfbS 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: AM3PEPF00009BA0.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 96eeff1a-7840-4036-55c1-08dc144ea3c4 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zuLwdCOw1W2R0SrZc2ppRCl4aeoTDWPUBjmTy7Hy4uHP5P8Nc/Z8RGFmkF4rxd1lc8X83xYLo2dZSY49xNVt30GcK94hCs9H/ZuXY6b/AZqRGC2TrKOWPpjD1PxmrYiFxGafFI7Y0vz6fwzs46SudrbuIXKfMNqwMJKstHxuYMyxitX7ltmMnMOkUCDlNMh5vsDM7xFTxO/XmZgYuOiAtyflddb8kgs0gUepZr5WlXX6G3anmAW5ICJSgtPwyCONDwNcz1Hl2Tz6I4GcOK0FMZNK9KnvBxfFlOrZ1nfRBPVaxcp+8GvwJbdwO0RfpR5SeCExeqFZTYbv4dIpwSj/QvTJ0ctyI4YsRelSZ215jt7w9l9lgIYD/Q40bWdJg9rUbDGG7r8kB/DEK2nY2GQ/flSncptYzYXGgJgpIko3B/AVcaESCtbh+isRuh6nbQ7mKTkQHLarDWZO1LnKWbtPAI2ccVLqX1VRJB4UYIv6B8cd3ipHEtm0XF9namDpz6cAa6xRV6q9Wi1i9YvKB+mVLRu+4NsAxY3+Q/oa1lSIkX3C0wxtY39Xu728Xo7OGGXJAFwFptA6XViIB2y6OrY379KLQmZFCFDq1nBaCswyAipMooPT+bL9gnHBwIv1cvBAZ73jr3uOhXCxbpDFrtxhO1AVjkxjRkLlaTWlliWAzZ889e08MGDLY6MXiuoQiPyxqENXz7h3GBj5Wfs6T3QYawg2tQPUcu0vnpdf2v4yIqxU/5j8j9IjVZpM5pmoCcLd1Ld0UwWEyKP1lygoZ22SwA== 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)(346002)(39860400002)(376002)(396003)(136003)(230922051799003)(1800799012)(451199024)(82310400011)(64100799003)(186009)(36840700001)(40470700004)(46966006)(356005)(81166007)(82740400003)(36756003)(40460700003)(40480700001)(86362001)(336012)(26005)(83380400001)(36860700001)(41300700001)(6512007)(70206006)(54906003)(70586007)(316002)(44144004)(33964004)(6666004)(2616005)(6506007)(47076005)(478600001)(6916009)(6486002)(2906002)(5660300002)(44832011)(4326008)(235185007)(8936002)(8676002)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jan 2024 15:45:26.2732 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c94c74de-1fd9-4b70-a99c-08dc144ea97d 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: AM3PEPF00009BA0.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB6372 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 In r14-5820-ga49befbd2c783e751dc2110b544fe540eb7e33eb I added support to RTL-SSA for inserting new insns, which included support for users creating new defs. However, I missed that apply_changes_to_insn needed updating to ensure that the new defs actually got inserted into the main def chain. This meant that when the aarch64 ldp/stp pass inserted a new stp insn, the stp would just get skipped over during subsequent alias analysis, as its def never got inserted into the memory def chain. This (unsurprisingly) led to wrong code. This patch fixes the issue by ensuring new user-created defs get inserted. I would have preferred to have used a flag internal to the defs instead of a separate data structure to keep track of them, but since machine_mode increased to 16 bits we're already at 64 bits in access_info, and we can't really reuse m_is_temp as the logic in finalize_new_accesses requires it to get cleared. Bootstrapped/regtested as a series on aarch64-linux-gnu, OK for trunk? Thanks, Alex gcc/ChangeLog: PR target/113070 * rtl-ssa.h: Include hash-set.h. * rtl-ssa/changes.cc (function_info::finalize_new_accesses): Add new_sets parameter and use it to keep track of new user-created sets. (function_info::apply_changes_to_insn): Also call add_def on new sets. (function_info::change_insns): Add hash_set to keep track of new user-created defs. Plumb it through. * rtl-ssa/functions.h: Add hash_set parameter to finalize_new_accesses and apply_changes_to_insn. --- gcc/rtl-ssa.h | 1 + gcc/rtl-ssa/changes.cc | 28 +++++++++++++++++++++------- gcc/rtl-ssa/functions.h | 6 ++++-- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/gcc/rtl-ssa.h b/gcc/rtl-ssa.h index f0cf656f5ac..17337639ae8 100644 --- a/gcc/rtl-ssa.h +++ b/gcc/rtl-ssa.h @@ -50,6 +50,7 @@ #include "mux-utils.h" #include "rtlanal.h" #include "cfgbuild.h" +#include "hash-set.h" // Provides the global crtl->ssa. #include "memmodel.h" diff --git a/gcc/rtl-ssa/changes.cc b/gcc/rtl-ssa/changes.cc index ce51d6ccd8d..6119ec3535b 100644 --- a/gcc/rtl-ssa/changes.cc +++ b/gcc/rtl-ssa/changes.cc @@ -429,7 +429,8 @@ update_insn_in_place (insn_change &change) // POS gives the final position of INSN, which hasn't yet been moved into // place. void -function_info::finalize_new_accesses (insn_change &change, insn_info *pos) +function_info::finalize_new_accesses (insn_change &change, insn_info *pos, + hash_set &new_sets) { insn_info *insn = change.insn (); @@ -465,6 +466,12 @@ function_info::finalize_new_accesses (insn_change &change, insn_info *pos) // later in case we see a second write to the same resource. def_info *perm_def = allocate (change.insn (), def->resource ()); + + // Keep track of the new set so we remember to add it to the + // def chain later. + if (new_sets.add (perm_def)) + gcc_unreachable (); // We shouldn't see duplicates here. + def->set_last_def (perm_def); def = perm_def; } @@ -647,7 +654,8 @@ function_info::finalize_new_accesses (insn_change &change, insn_info *pos) // Copy information from CHANGE to its underlying insn_info, given that // the insn_info has already been placed appropriately. void -function_info::apply_changes_to_insn (insn_change &change) +function_info::apply_changes_to_insn (insn_change &change, + hash_set &new_sets) { insn_info *insn = change.insn (); if (change.is_deletion ()) @@ -659,10 +667,11 @@ function_info::apply_changes_to_insn (insn_change &change) // Copy the cost. insn->set_cost (change.new_cost); - // Add all clobbers. Sets and call clobbers never move relative to - // other definitions, so are OK as-is. + // Add all clobbers and newly-created sets. Existing sets and call + // clobbers never move relative to other definitions, so are OK as-is. for (def_info *def : change.new_defs) - if (is_a (def) && !def->is_call_clobber ()) + if ((is_a (def) && !def->is_call_clobber ()) + || (is_a (def) && new_sets.contains (def))) add_def (def); // Add all uses, now that their position is final. @@ -793,6 +802,10 @@ function_info::change_insns (array_slice changes) placeholders[i] = placeholder; } + // We need to keep track of newly-added sets as these need adding to + // the def chain later. + hash_set new_sets; + // 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. // @@ -806,7 +819,8 @@ function_info::change_insns (array_slice changes) insn_info *placeholder = placeholders[i]; if (!change.is_deletion ()) finalize_new_accesses (change, - placeholder ? placeholder : change.insn ()); + placeholder ? placeholder : change.insn (), + new_sets); } // Remove all definitions that are no longer needed. After the above, @@ -861,7 +875,7 @@ function_info::change_insns (array_slice changes) // Apply the changes to the underlying insn_infos. for (insn_change *change : changes) - apply_changes_to_insn (*change); + apply_changes_to_insn (*change, new_sets); // Now that the insns and accesses are up to date, add any REG_UNUSED notes. for (insn_change *change : changes) diff --git a/gcc/rtl-ssa/functions.h b/gcc/rtl-ssa/functions.h index 962180e27d6..4573453d896 100644 --- a/gcc/rtl-ssa/functions.h +++ b/gcc/rtl-ssa/functions.h @@ -299,8 +299,10 @@ private: void process_uses_of_deleted_def (set_info *); insn_info *add_placeholder_after (insn_info *); void possibly_queue_changes (insn_change &); - void finalize_new_accesses (insn_change &, insn_info *); - void apply_changes_to_insn (insn_change &); + void finalize_new_accesses (insn_change &, insn_info *, + hash_set &); + void apply_changes_to_insn (insn_change &, + hash_set &); void init_function_data (); void calculate_potential_phi_regs (build_info &); From patchwork Sat Jan 13 15:46:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Coplan X-Patchwork-Id: 84046 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 DF9353858C62 for ; Sat, 13 Jan 2024 15:47:11 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2080.outbound.protection.outlook.com [40.107.7.80]) by sourceware.org (Postfix) with ESMTPS id EE6863858D28 for ; Sat, 13 Jan 2024 15:46:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EE6863858D28 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 EE6863858D28 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.7.80 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1705160796; cv=pass; b=ZPzlp6UQ602dd/Vu+YhgxGSRX59CO1QrmGdW15sITL6GqKpGoH0zE6ZMEZaZrswK180HpZq4oHL2hhWUNOr9mv3nO9gTENSAmjCNv/PCa1ldQv+YOuo5dA67HRLYmjg4l7oocvKAzi+xPDn20m4+gFb/RIdHFOQElrAURUry6CM= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1705160796; c=relaxed/simple; bh=X08BrXxosggwxMRzrQfMhfmUZOiNTmLRRzbnKKDTfx8=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:Message-ID: MIME-Version; b=DauHZtTLLxru1IHsqeGeWSTyCYLWTiEc2rbcuRJjuJurVgEo1U0JdQe0UZ+jreaQ1k+pWcNw2QloGhUDoYkOvd5n8JsZtZETCPIvw29fV+FryBp8AVj5lDH0z3oDkAZhpSNMPD77dPOvmqm6fPk1x2PdlesnbUa/CLAGlSKiOgg= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=HSKpDP8OrolO1KqmBUWuEQTS0jWGIT8p3W2/fns01fnfZVNIW81JkU32mjKrqPgqXoNStmk1dMw5/6HssPS42elWDbCSMdCWzSWX8mSf5atN6g6zxHHlNPGEMHSFQ2h0Bd5n01jMF/YQDMAMurcem+hss6+ND/Cz/4TnEbQdfzmiMei3IE5X3FT0J27UdAcDXvuvoSBQmFy97+l1K5Xe8m330Zrkll7yqwN99gOPRLTxnpVQS+MjXIsTtNFCSLgwysk/dtTrma6FQguPVDWlDSipaS5w2Z1SQ02U8YQBjUEvu3fxTQ4DTZWF1yMTTIWCCo9FEtQM/PLaCnMk7fOpkw== 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=+KjfU+FSB4YH6PQT9iejcnaFNck5Ijot1+eCo8qqgIc=; b=M5joyLN93ZNYevvFDAK1C99ow7Kq0zZ+CYcVxoyn/hOyMLv/5D+HVcJQW035ciQvLUXNApbYfXDBPb09N5i/J/iDdHaFv/w/SMedv2kDpTobmh+WdZc7iiEQ4w0egi6+dPJ7zjxWnGpMgOb3hJkA9yZvh1pZx4I+RMdY52MeGU4+z1zpKd9M8yiZckbkCWWi/KNeS5zEdHZuFgs9Y6G91KfLZlHjporEusCUX+a879TM8m8/uRgdcPEgpdKwv2nHIZdz+dMeMVVWMD0W9rZPySg83XQFjc5IAWU/W8aCHBeKiF2hNTqOprNMj8P4mZ+PmEPsgvF80Y+O5PzkuSLBpg== 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=+KjfU+FSB4YH6PQT9iejcnaFNck5Ijot1+eCo8qqgIc=; b=LYrPyph5tgj+mtO5RmTjP/lCC7dASy8+8c7gQOupW3BwEFpSWiohIajLudUEIDHjJsOfpsTTp+QXgAVeiWxf5jNJC88cBzpV/5UbKCwWh4Gi0iZw7kgbUnbSdRjC59CnPFmanLfENJf+C9ZSLIKp5roHG3YlzAqol4TEzIag4yE= Received: from AS4P190CA0027.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:5d0::16) by DBBPR08MB6171.eurprd08.prod.outlook.com (2603:10a6:10:20f::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.21; Sat, 13 Jan 2024 15:46:30 +0000 Received: from AM4PEPF00025F95.EURPRD83.prod.outlook.com (2603:10a6:20b:5d0:cafe::7) by AS4P190CA0027.outlook.office365.com (2603:10a6:20b:5d0::16) 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:46:30 +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 AM4PEPF00025F95.mail.protection.outlook.com (10.167.16.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.0 via Frontend Transport; Sat, 13 Jan 2024 15:46:30 +0000 Received: ("Tessian outbound a297577ee0df:v228"); Sat, 13 Jan 2024 15:46:30 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: bada9bb6ac2baf35 X-CR-MTA-TID: 64aa7808 Received: from b748a1eb9ece.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id B61F188E-18AE-48B3-BF35-F2306BAB4CF8.1; Sat, 13 Jan 2024 15:46:23 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id b748a1eb9ece.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Sat, 13 Jan 2024 15:46:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=elzgx+HhQPv1A3av5nKeCyWXxlVqP+7mMZV6NJibfkVTa2tyMcNQucWuq3lGkRmyMVORbqxjk+3SUFsISotGsYsX+zypu+mmTPJLkgTstb/Y+6c48doaI6kojLPtxCZu4GP2wFQgXLamBiTO5a4i6SHq5xJASmehNMOlcOMN0SjACZT/YdsSRbW+IVXl+eJ5zuAasEUiiNQFJZFIGQoEXMfE//N7oD7o/H66ICtL+4/qdBFazj0JCMr5FXk91chLHmJcWLEbLicYpmbLzK2oAOMr31uYKj2Xxz7XPBItbtxP2zlRRkxdQ0+eDcuScRnR+BtAN9ILPTZ61VjKiqBODQ== 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=+KjfU+FSB4YH6PQT9iejcnaFNck5Ijot1+eCo8qqgIc=; b=NZwa8MHGZePh6kqHyPY3+qEWixDx5bmLRikgHQiUnhi99T1oZVhGMUleBdN+Kzs9ttMkNU6GomnqUMp9rX2I1eU1jWZ77kd3gun/VXMULotDsHVyYz3Yt2NtQLt2unbVriROnQN6hxcil3UMqH923FzeAgNCAb+S06hNM6kDIywZ9iExRs35Wn8AdZAAmWfTy3xebzPHmt1M2BX4TgCR278T1mnIRuPzsq2baMvXmjcpJy0S/0ueOwrZ/M8k0sRT8FWbN1HBHmWnkcbm3uJo+5PFVTdBYB0T4n9IjjnyVa1jg0cERuKrVE8Iq1+RtDGgxu6ngJT2JjZ6ZaltQqU75g== 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=+KjfU+FSB4YH6PQT9iejcnaFNck5Ijot1+eCo8qqgIc=; b=LYrPyph5tgj+mtO5RmTjP/lCC7dASy8+8c7gQOupW3BwEFpSWiohIajLudUEIDHjJsOfpsTTp+QXgAVeiWxf5jNJC88cBzpV/5UbKCwWh4Gi0iZw7kgbUnbSdRjC59CnPFmanLfENJf+C9ZSLIKp5roHG3YlzAqol4TEzIag4yE= 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 PAXPR08MB7490.eurprd08.prod.outlook.com (2603:10a6:102:2b7::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.17; Sat, 13 Jan 2024 15:46:20 +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:46:20 +0000 Date: Sat, 13 Jan 2024 15:46:15 +0000 From: Alex Coplan To: gcc-patches@gcc.gnu.org Cc: Richard Sandiford , Kyrylo Tkachov , Richard Earnshaw Subject: [PATCH 4/4] aarch64: Fix up uses of mem following stp insert [PR113070] Message-ID: Content-Disposition: inline X-ClientProxiedBy: LNXP265CA0023.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5e::35) To PAWPR08MB8958.eurprd08.prod.outlook.com (2603:10a6:102:33e::15) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: PAWPR08MB8958:EE_|PAXPR08MB7490:EE_|AM4PEPF00025F95:EE_|DBBPR08MB6171:EE_ X-MS-Office365-Filtering-Correlation-Id: 218563d5-62e7-4471-9e67-08dc144ecfd9 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: 9G9lSCxOO7rx4NpR7JzkyEQrbhIQtX5/ItbWH7N37sHbO/da6ccxcS8ss8xiAi3gre/ekD7afRBoxfDEoVBAjdgkknMZxo/vM3no5su6l4DY5UNu1feYk+luPTzWI164M/M72EqKUsJ+PKCpgeWeqlGh7/EJh+zU2e6MwrvKtNDGThtEZHK0gvp0a0IXmjvv8QQ2GENeRaMzHR3clkqjEZLpVLV2F8ONuDEKPeQRevLZP9D+mvO1DG3CIP/y2mWqu+cwXNuAGstG1RuhsZMJpR/rgol8P81anA6mqQZhQD+RzehveMurCApuhvl1npFiKXrOX2RveXtENixDV7IY3teb8FI772j8aioSnaY1ri8NYeAcZWCSEMRscppjR9/bBD6rzyCsH2QutY7Krb7MFG8cjx8Z09mC9GUYsjGASkuiebexUxc+OjSRlWWsYA3/WG8275UFLPfnsvv52JONZClScUlj9LPgZCEQJU9twiVWIVp8F+GJH+BmGEzUrVUBhn6xTw3aAFT26D+DWZ/4SMOWniYJCMg0lXLrJbcC6s7XybPkYP0VXo17zdlfpNWhI/rOjb8fg4oAXsmJTnKmKdps7/TD9NuOKNush7hLX2b0OAruUynVOO5jYblYJW+a 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)(136003)(376002)(396003)(346002)(366004)(39860400002)(230922051799003)(64100799003)(186009)(1800799012)(451199024)(6512007)(66946007)(33964004)(6506007)(2616005)(66476007)(316002)(66556008)(6666004)(478600001)(54906003)(44144004)(6486002)(66899024)(26005)(83380400001)(41300700001)(44832011)(2906002)(5660300002)(8936002)(8676002)(4326008)(235185007)(6916009)(38100700002)(36756003)(86362001)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB7490 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: AM4PEPF00025F95.EURPRD83.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 5072f344-e12c-4f36-802c-08dc144ec932 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8xQLmvL1+KTaOvbarkXG5wf/6MGHsgqk9V6z6UbNkUfdrdtUR3YV2aVfPnumA3FFNvs5oc8e9E6QpXJf+Vcu8kkDdcbCobX2EKDQ2Lo51DFoSHDXipmqafyERdbrfCaCLw3QUvjT4s+8NpMVF6EclxI8c4EuBj1c2waI+7lJDuGRIqf6ZTGUD73ViyKEiVxpCpik8Xfwl5R/6GGMzyw9PY1bdud5Lj3ls/Qqm6Z3ne6MREkAVReOpDPPbZV6dVDvE6Reql418NzHnha6OYk8IOnk+MmOfIBbkY0GDBAlwqyHzonDhrn60/CAz4t8Wx3wAmqtMtwnYT1nlBerpLJjPdQIU+f4NYjPwc3yaNpjjPMtMfqy90AvSPwolv7YOQhtPEnedXyS9r8vC0yC5PWUP2f6HQai+g3kTfZoGLlMbScoz+tCLKWTNb8z9X5OL+z/tuLk0weDJDNMTpVTHA5J5+HYlexfYk/YHdaQX0ysx2nm8yqQd+wQsEsTJX6s6/OwyYg2UFcvua+ukWHfHpjRdCZuGoOiRcU+/exLdascMs7rX5iIyi6MBm+EgDFX+CJinI1Slqq2qnBrVR6ZRGirAhfBByJlCcANue0NpA1yUikxNomBzhD40hq4yb2hjJ+CaHfkHrnH8GfMc2xRjI1iiMiGKtr/DgTxqxj7Lb8QN+H4SaZlDw1OpPxqwrv4qrBWgRONwvsqnc9exg/SN9k0mdA4uPPE6S3JgCWkR02M7T8= X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:; 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)(346002)(376002)(136003)(396003)(39860400002)(230922051799003)(82310400011)(451199024)(64100799003)(186009)(1800799012)(40470700004)(46966006)(36840700001)(86362001)(82740400003)(6916009)(478600001)(70206006)(70586007)(6666004)(6486002)(6506007)(81166007)(356005)(44832011)(2616005)(44144004)(26005)(6512007)(336012)(54906003)(33964004)(4326008)(40480700001)(8936002)(316002)(8676002)(83380400001)(36756003)(41300700001)(235185007)(2906002)(40460700003)(36860700001)(5660300002)(47076005)(66899024)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jan 2024 15:46:30.6292 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 218563d5-62e7-4471-9e67-08dc144ecfd9 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: AM4PEPF00025F95.EURPRD83.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB6171 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 As the PR shows (specifically #c7) we are missing updating uses of mem when inserting an stp in the aarch64 load/store pair fusion pass. This patch fixes that. RTL-SSA has a simple view of memory and by default doesn't allow stores to be re-ordered w.r.t. other stores. In the ldp fusion pass, we do our own alias analysis and so can re-order stores over other accesses when we deem this is safe. If neither store can be re-purposed (moved into the required position to form the stp while respecting the RTL-SSA constraints), then we turn both the candidate stores into "tombstone" insns (logically delete them) and insert a new stp insn. As it stands, we implement the insert case separately (after dealing with the candidate stores) in fuse_pair by inserting into the middle of the vector of changes. This is OK when we only have to insert one change, but with this fix we would need to insert the change for the new stp plus multiple changes to fix up uses of mem (note the number of fix-ups is naturally bounded by the alias limit param to prevent quadratic behaviour). If we kept the code structured as is and inserted into the middle of the vector, that would lead to repeated moving of elements in the vector which seems inefficient. The structure of the code would also be a little unwieldy. To improve on that situation, this patch introduces a helper class, stp_change_builder, which implements a state machine that helps to build the required changes directly in program order. That state machine is reponsible for deciding what changes need to be made in what order, and the code in fuse_pair then simply follows those steps. Together with the fix in the previous patch for installing new defs correctly in RTL-SSA, this fixes PR113070. We take the opportunity to rename the function decide_stp_strategy to try_repurpose_store, as that seems more descriptive of what it actually does, since stp_change_builder is now responsible for the overall change strategy. Bootstrapped/regtested as a series with/without the passes enabled on aarch64-linux-gnu, OK for trunk? Thanks, Alex gcc/ChangeLog: PR target/113070 * config/aarch64/aarch64-ldp-fusion.cc (struct stp_change_builder): New. (decide_stp_strategy): Reanme to ... (try_repurpose_store): ... this. (ldp_bb_info::fuse_pair): Refactor to use stp_change_builder to construct stp changes. Fix up uses when inserting new stp insns. --- gcc/config/aarch64/aarch64-ldp-fusion.cc | 248 ++++++++++++++++++----- 1 file changed, 194 insertions(+), 54 deletions(-) diff --git a/gcc/config/aarch64/aarch64-ldp-fusion.cc b/gcc/config/aarch64/aarch64-ldp-fusion.cc index 689a8c884bd..703cfb1228c 100644 --- a/gcc/config/aarch64/aarch64-ldp-fusion.cc +++ b/gcc/config/aarch64/aarch64-ldp-fusion.cc @@ -844,11 +844,138 @@ def_upwards_move_range (def_info *def) return range; } +// Class that implements a state machine for building the changes needed to form +// a store pair instruction. This allows us to easily build the changes in +// program order, as required by rtl-ssa. +struct stp_change_builder +{ + enum class state + { + FIRST, + INSERT, + FIXUP_USE, + LAST, + DONE + }; + + enum class action + { + TOMBSTONE, + CHANGE, + INSERT, + FIXUP_USE + }; + + struct change + { + action type; + insn_info *insn; + }; + + bool done () const { return m_state == state::DONE; } + + stp_change_builder (insn_info *insns[2], + insn_info *repurpose, + insn_info *dest) + : m_state (state::FIRST), m_insns { insns[0], insns[1] }, + m_repurpose (repurpose), m_dest (dest), m_use (nullptr) {} + + change get_change () const + { + switch (m_state) + { + case state::FIRST: + return { + m_insns[0] == m_repurpose ? action::CHANGE : action::TOMBSTONE, + m_insns[0] + }; + case state::LAST: + return { + m_insns[1] == m_repurpose ? action::CHANGE : action::TOMBSTONE, + m_insns[1] + }; + case state::INSERT: + return { action::INSERT, m_dest }; + case state::FIXUP_USE: + return { action::FIXUP_USE, m_use->insn () }; + case state::DONE: + break; + } + + gcc_unreachable (); + } + + // Transition to the next state. + void advance () + { + switch (m_state) + { + case state::FIRST: + if (m_repurpose) + m_state = state::LAST; + else + m_state = state::INSERT; + break; + case state::INSERT: + { + def_info *def = memory_access (m_insns[0]->defs ()); + while (*def->next_def ()->insn () <= *m_dest) + def = def->next_def (); + + // Now we know DEF feeds the insertion point for the new stp. + // Look for any uses of DEF that will consume the new stp. + gcc_assert (*def->insn () <= *m_dest + && *def->next_def ()->insn () > *m_dest); + + if (auto set = dyn_cast (def)) + for (auto use : set->nondebug_insn_uses ()) + if (*use->insn () > *m_dest) + { + m_use = use; + break; + } + + if (m_use) + m_state = state::FIXUP_USE; + else + m_state = state::LAST; + break; + } + case state::FIXUP_USE: + m_use = m_use->next_nondebug_insn_use (); + if (!m_use) + m_state = state::LAST; + break; + case state::LAST: + m_state = state::DONE; + break; + case state::DONE: + gcc_unreachable (); + } + } + +private: + state m_state; + + // Original candidate stores. + insn_info *m_insns[2]; + + // If non-null, this is a candidate insn to change into an stp. Otherwise we + // are deleting both original insns and inserting a new insn for the stp. + insn_info *m_repurpose; + + // Destionation of the stp, it will be placed immediately after m_dest. + insn_info *m_dest; + + // Current nondebug use that needs updating due to stp insertion. + use_info *m_use; +}; + // Given candidate store insns FIRST and SECOND, see if we can re-purpose one // of them (together with its def of memory) for the stp insn. If so, return // that insn. Otherwise, return null. static insn_info * -decide_stp_strategy (insn_info *first, +try_repurpose_store (insn_info *first, insn_info *second, const insn_range_info &move_range) { @@ -1253,7 +1380,7 @@ ldp_bb_info::fuse_pair (bool load_p, insn_info *insns[2] = { first, second }; - auto_vec changes (4); + auto_vec changes; auto_vec tombstone_uids (2); rtx pats[2] = { @@ -1455,9 +1582,9 @@ ldp_bb_info::fuse_pair (bool load_p, if (load_p) { - changes.quick_push (make_delete (first)); + changes.safe_push (make_delete (first)); pair_change = make_change (second); - changes.quick_push (pair_change); + changes.safe_push (pair_change); pair_change->move_range = move_range; pair_change->new_defs = merge_access_arrays (attempt, @@ -1474,18 +1601,22 @@ ldp_bb_info::fuse_pair (bool load_p, } else { - insn_info *store_to_change = decide_stp_strategy (first, second, + using Action = stp_change_builder::action; + insn_info *store_to_change = try_repurpose_store (first, second, move_range); - - if (store_to_change && dump_file) - fprintf (dump_file, " stp: re-purposing store %d\n", - store_to_change->uid ()); - + insn_info *stp_dest = move_range.singleton (); + gcc_assert (stp_dest); + stp_change_builder builder (insns, store_to_change, stp_dest); insn_change *change; - for (int i = 0; i < 2; i++) + set_info *new_set = nullptr; + for (; !builder.done (); builder.advance ()) { - change = make_change (insns[i]); - if (insns[i] == store_to_change) + auto action = builder.get_change (); + change = (action.type == Action::INSERT) + ? nullptr : make_change (action.insn); + switch (action.type) + { + case Action::CHANGE: { set_pair_pat (change); change->new_uses = merge_access_arrays (attempt, @@ -1495,67 +1626,76 @@ ldp_bb_info::fuse_pair (bool load_p, auto d2 = drop_memory_access (input_defs[1]); change->new_defs = merge_access_arrays (attempt, d1, d2); gcc_assert (change->new_defs.is_valid ()); - def_info *stp_def = memory_access (store_to_change->defs ()); + def_info *stp_def = memory_access (change->insn ()->defs ()); change->new_defs = insert_access (attempt, stp_def, change->new_defs); gcc_assert (change->new_defs.is_valid ()); change->move_range = move_range; pair_change = change; + break; } - else + case Action::TOMBSTONE: { - // Note that we are turning this insn into a tombstone, - // we need to keep track of these if we go ahead with the - // change. - tombstone_uids.quick_push (insns[i]->uid ()); - rtx_insn *rti = insns[i]->rtl (); + tombstone_uids.quick_push (change->insn ()->uid ()); + rtx_insn *rti = change->insn ()->rtl (); validate_change (rti, &PATTERN (rti), gen_tombstone (), true); validate_change (rti, ®_NOTES (rti), NULL_RTX, true); change->new_uses = use_array (nullptr, 0); + break; } - gcc_assert (change->new_uses.is_valid ()); - changes.quick_push (change); - } + case Action::INSERT: + { + if (dump_file) + fprintf (dump_file, + " stp: cannot re-purpose candidate stores\n"); - if (!store_to_change) - { - // Tricky case. Cannot re-purpose existing insns for stp. - // Need to insert new insn. - if (dump_file) - fprintf (dump_file, - " stp fusion: cannot re-purpose candidate stores\n"); - - auto new_insn = crtl->ssa->create_insn (attempt, INSN, pair_pat); - change = make_change (new_insn); - change->move_range = move_range; - change->new_uses = merge_access_arrays (attempt, - input_uses[0], - input_uses[1]); - gcc_assert (change->new_uses.is_valid ()); - - auto d1 = drop_memory_access (input_defs[0]); - auto d2 = drop_memory_access (input_defs[1]); - change->new_defs = merge_access_arrays (attempt, d1, d2); - gcc_assert (change->new_defs.is_valid ()); - - auto new_set = crtl->ssa->create_set (attempt, new_insn, memory); - change->new_defs = insert_access (attempt, new_set, - change->new_defs); - gcc_assert (change->new_defs.is_valid ()); - changes.safe_insert (1, change); - pair_change = change; + auto new_insn = crtl->ssa->create_insn (attempt, INSN, pair_pat); + change = make_change (new_insn); + change->move_range = move_range; + change->new_uses = merge_access_arrays (attempt, + input_uses[0], + input_uses[1]); + gcc_assert (change->new_uses.is_valid ()); + + auto d1 = drop_memory_access (input_defs[0]); + auto d2 = drop_memory_access (input_defs[1]); + change->new_defs = merge_access_arrays (attempt, d1, d2); + gcc_assert (change->new_defs.is_valid ()); + + new_set = crtl->ssa->create_set (attempt, new_insn, memory); + change->new_defs = insert_access (attempt, new_set, + change->new_defs); + gcc_assert (change->new_defs.is_valid ()); + pair_change = change; + break; + } + case Action::FIXUP_USE: + { + // This use now needs to consume memory from our stp. + if (dump_file) + fprintf (dump_file, + " stp: changing i%d to use mem from new stp " + "(after i%d)\n", + action.insn->uid (), stp_dest->uid ()); + change->new_uses = drop_memory_access (change->new_uses); + gcc_assert (new_set); + auto new_use = crtl->ssa->create_use (attempt, action.insn, + new_set); + change->new_uses = insert_access (attempt, new_use, + change->new_uses); + break; + } + } + changes.safe_push (change); } } if (trailing_add) changes.quick_push (make_delete (trailing_add)); - auto n_changes = changes.length (); - gcc_checking_assert (n_changes >= 2 && n_changes <= 4); - auto is_changing = insn_is_changing (changes); - for (unsigned i = 0; i < n_changes; i++) + for (unsigned i = 0; i < changes.length (); i++) gcc_assert (rtl_ssa::restrict_movement_ignoring (*changes[i], is_changing)); // Check the pair pattern is recog'd.