From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2047.outbound.protection.outlook.com [40.107.22.47]) by sourceware.org (Postfix) with ESMTPS id D7BD03858D20 for ; Mon, 22 Jan 2024 21:44:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D7BD03858D20 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 D7BD03858D20 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.22.47 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1705959879; cv=pass; b=PAOt5B4u6vOOoRDOjsaGmc7MQ6f/HE1/0vZpDp0v9XqyBuETjbEORFTNWhfYKTYkfEnb9C9cERodiJKKIaA3qBkkhX6BHUwJMgRoX+M+yi4meFQzHBRWCyhkW0NWNGvgyx97uDxRjbwnPqMI1JIyLlobmZKt5ocegUojlhMpfs8= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1705959879; c=relaxed/simple; bh=hEVu2/DffHSCc3DOq0/4hWbUWdleA72Tsz2Xb0DZajA=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:Message-ID: MIME-Version; b=ooqX0Sf7N9oqfjoPBcF/5wd/Rra5KPqR7gcYoTiNGOZ3MXWd3jPddM6lcvx/E0En3jjT/Pqs0SAy9mWFH1uduFTfEQ9PAAfgb9VsQ/W7OrCLntP5B7ioao1Qk5C9kRkhhJZD2gVt1SiS77vgKNipdvmxEf4+PbErMCh+gzrncv0= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=nZk+JQ9K8IeZE/pwhjThU7fNog0fE9aD12UrPXYjK+KQh1Jr0mCjTx9Ps8XQJ1FBLqU1o97m1henqvlIvB/zvi9EtbNHWeWM76oz3hM4/ppx8v2MHl8xsyAKm9DvEY4jUnaZZp1b17cd5TpfJ0v0+vAwPXyouf7C1QPeMrl6W3ZkEgbW+f9D35CqI9kuq/oN5yP3g3REV4XUX48UlFaueUGUKPMN+63DTQPMaSLD+aLSA2L0+VNSK/ukcFN7P1k1IJVLCwFb/yw1tUd4xRCbn0z/C5uK435VLh8dg7F9xJrEhQSMR6iKVRTiIDM0aqUhcAUBmRghD+DpKYdKkCk7pQ== 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=Ol+WnErFpPDg8qMOcvDu6kvHXOeFA5LGnxoTAqJV+Bc=; b=UprTBKRwdMaUkamzi4ZYhUXymhuYmvPDuQZgr+8FqIpMWYts7RMtmSoyn39kBvDzaJQHwqo0/LnBG7KOymwh1N+ccFePmoOIvZhHFbh4WYdCwZEcIj6RjGCmHIt5jJ/i3iSVDDWoQby3AJ5/IaP6N64Xo9BlyrPl9u7Jxj0xtNGoOsbmvKroz1e/+C4WQjEOee/6mEtFxaWOLQqMOrcmTund/wlR+mqxvaM1gOIKj+sBe5S+cGWNTJ/dqQ68kGj1cprw22hs828S8aa+vVjQEt9uMQYHQi4jUD9ps9/DUJZtZy3f74Ma7gh9q84AtpiiumUwjIVlq7wnz313dC9Wyw== 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=Ol+WnErFpPDg8qMOcvDu6kvHXOeFA5LGnxoTAqJV+Bc=; b=4qa7+KMroasJTfzx/fj6tq20QiOE0sXUQXyIY4i542b5DwNYNyENZH7/n83eqSPmitg/zjUm4e5R2ibSZDxzqmzylw6LsffEEGlY1/+E/Bpbq1Kx6tKkHYm5WebuIpfDc+G2OVe9+Jd3kELnpFFlGAEdgcGQL7pCFyw6ts/ursc= Received: from AS4P251CA0002.EURP251.PROD.OUTLOOK.COM (2603:10a6:20b:5d2::8) by DBBPR08MB5932.eurprd08.prod.outlook.com (2603:10a6:10:207::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.32; Mon, 22 Jan 2024 21:44:31 +0000 Received: from AMS0EPF000001B3.eurprd05.prod.outlook.com (2603:10a6:20b:5d2:cafe::3d) by AS4P251CA0002.outlook.office365.com (2603:10a6:20b:5d2::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.32 via Frontend Transport; Mon, 22 Jan 2024 21:44:31 +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 AMS0EPF000001B3.mail.protection.outlook.com (10.167.16.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.16 via Frontend Transport; Mon, 22 Jan 2024 21:44:31 +0000 Received: ("Tessian outbound c87008563c51:v228"); Mon, 22 Jan 2024 21:44:30 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 95be1f47f8b31d79 X-CR-MTA-TID: 64aa7808 Received: from 63085236d33f.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 407A6A50-D000-49C9-9A0E-A5985C2C8358.1; Mon, 22 Jan 2024 21:44:23 +0000 Received: from EUR02-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 63085236d33f.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 22 Jan 2024 21:44:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A8GFDC3mlsDcfcmi6sDE6v6Eg5w2DPYmLmhBxnGNCZL38X8GgAbHdW3qubJok9ys2+48P8GSAnjJmO+k/qOQsVWOI4iFNQ8r+dkEluBxjvs0bcXIzF8Y3rN6fFKA6ESVI77K+RS2ybfiHPZ+o+D0rwgDURq60qTZmkhBw/86hhI5aR5Brp6XsaM1KXTLM550DzbxWr7Dok+771E5Zy8gGIi95RLxHGixwYiVB4y/5o2VhXjqnXgRJCDHZZeoRvCmlzUIcf//nqlScCtBhUuPfxhWx8Bfx19/FkGqmxOMMDwh+ACHJKaV6rcc2EgE/guJsVs5MHgESjLVchfhK48PWA== 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=Ol+WnErFpPDg8qMOcvDu6kvHXOeFA5LGnxoTAqJV+Bc=; b=bcLtYy5fXPf109DRzya6rCDYzXQWCf2wRucHiM1NKTTZQ20P2RIhRgRhBbAtxEnkZP879WZEZgSEFZMdq3X4HcTR3w9QqQaJpyZfwcvXMY4BHg7PIOV7+0FxKEw4QFRBW6ap8cQbxbsSko5ce5ljeN50cCgojxZVVKXPuB8R/VS5XImLoUjUIKfZ3H0n3XIGlh9h27haDaTBVv4/sE6K8fvEG1GqLlHp+WNdNWCrPBCQmsVNWZ+ITK7+Sd/nEWJj2E28skAWJcFnnEIjkxQuUBRf84U+oIo4bvr8KUc2RxwwzuWXFZEfRvdOY49HFh6VcEYPgpzXW89H84emxmML0g== 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=Ol+WnErFpPDg8qMOcvDu6kvHXOeFA5LGnxoTAqJV+Bc=; b=4qa7+KMroasJTfzx/fj6tq20QiOE0sXUQXyIY4i542b5DwNYNyENZH7/n83eqSPmitg/zjUm4e5R2ibSZDxzqmzylw6LsffEEGlY1/+E/Bpbq1Kx6tKkHYm5WebuIpfDc+G2OVe9+Jd3kELnpFFlGAEdgcGQL7pCFyw6ts/ursc= 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 VE1PR08MB5822.eurprd08.prod.outlook.com (2603:10a6:800:1a7::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.32; Mon, 22 Jan 2024 21: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.7202.035; Mon, 22 Jan 2024 21:44:21 +0000 Date: Mon, 22 Jan 2024 21:44:19 +0000 From: Alex Coplan To: gcc-patches@gcc.gnu.org, Kyrylo Tkachov , Richard Earnshaw , richard.sandiford@arm.com Subject: Re: [PATCH 3/4] rtl-ssa: Ensure new defs get inserted [PR113070] Message-ID: References: Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: LO4P265CA0256.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:37c::16) To PAWPR08MB8958.eurprd08.prod.outlook.com (2603:10a6:102:33e::15) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: PAWPR08MB8958:EE_|VE1PR08MB5822:EE_|AMS0EPF000001B3:EE_|DBBPR08MB5932:EE_ X-MS-Office365-Filtering-Correlation-Id: 617e4200-ef3e-40c5-9464-08dc1b9350f8 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: jfOcI34EZjeWbbZ7EJAOVA4jP4VKSgVI7nx8XrbQ7mzKHwgfBU/3O2TtZTuROaiH3rL4UL7BFcYK1B/lt6FZYXf/pp8NBB9JoRVXv5XDPFk9TqfLsPfY9UGlIF9vg9nXBF/4YqWeHZYhC3XKMXOsFd7h/71cY/ifGCzo8lowWnHtCIXeuJUSObw9JQ/JNv9dS9F7LjtEa5MBzhRjHsGO0CMmPHsFVizL9WoMtwGGV5Qzdi7DEtr3xQYt5GiQn4qjwzTPHlYa1wYaAjsMMMN3mb/ObCh3qShvwBm/JcI20qzrZVf/4YUOnntqzE8/A/8xSPTD17qHU4zPuFJY4mPEFdBHhIxv0pXtKPlNK26xUBTcHBr6fK3otqrc417NJoUb7bJjuOeTUhTB6BEEmklkkLG/gBlyC+x8xugKrfhVz1LWigNC6TLzqgfo/ksBJ0CdiwO4FTLuovfxTOkCmVQhyS3VwwKa/BTxf3wo/7JLfDqbPDIaZI5Pd1OOM7Qxi57nE0ol+8fcPygfxuOyue0Q+js9mv0dXr3upNNR00jHwAYZ66kc0vtrsY/EllJNBOTO 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)(376002)(346002)(396003)(366004)(136003)(39860400002)(230922051799003)(451199024)(64100799003)(1800799012)(186009)(41300700001)(26005)(36756003)(6506007)(478600001)(2616005)(53546011)(83380400001)(38100700002)(6512007)(316002)(110136005)(44832011)(5660300002)(8936002)(66476007)(66946007)(6636002)(66556008)(86362001)(6486002)(8676002)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5822 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: AMS0EPF000001B3.eurprd05.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 0b819585-33c0-45ff-86ff-08dc1b934b49 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XRhYOZijYAjbTtWi/pkTQWMcpUCe0NorPjbRNoI/+Jfv+Ecvm1CCZ5e+hbAuLZ92KjN9sgMDmUPHDbJl3Iws1OU2SF4QbMSNH5jbMX/rg+fc+Xii891jb9uXB3IyyIfCIbrowEQnsTGQdz4gEtQsKFXW+VqCX/mufSJrZFBoBOLiENEubgOXsyaSVmOJm+LVwzDKmDiN7NRQXvqNX3pXmoQMYK9FdLI1swuP6LzzvktOyUauTLCfguxYV2mmuCof3RPYCIs+KlBRWX1bSXck04e9fw035OH3xVlFQkUw7mvzVKg1hZBKnMi63sncuBO974WZUfIAQOYJF3STetfHyw5V9PtTOddNWOgn7jQ1g6/yfspiKs5kfasVkU5Jc6OcaD/I+wINud9zXXr1oj274ADAv0vHSdzhJojJYCVxJqzEUfkXnbwibDRKpS9wC6tglBwyqQKhs8GTFytUPNi9FSwlEYNSPfWeUHT4sN9kxOC7yrpx4d4i3A1D6Js/KfL1CduekvdHIzcz2IA46EcW3qTrMhyt1fOqVrLl/x9TomNYl1f/5h2z2TLHqXtw75Exuvdvp9y4EGpGqWKZS8Let0JaJo3oSg9uYHli+4IKTzEzQP7MZbz6ubnhTqNt/Zc8kMqlsQpSXwVcBB9MGTXRY0mMDeHPPQke24qniFcZDnBlAlG22bEy38uXyBv5fJS2qs9p5HMHVk7/BYFao2bmfTR2Nkem5rjcKJ4zISXafbKQvOb/zMHrCc6XafF5RG56 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)(136003)(376002)(39860400002)(346002)(230922051799003)(1800799012)(82310400011)(451199024)(64100799003)(186009)(46966006)(36840700001)(40470700004)(356005)(82740400003)(81166007)(36756003)(40460700003)(40480700001)(86362001)(83380400001)(26005)(2616005)(336012)(36860700001)(316002)(70586007)(70206006)(8676002)(8936002)(6486002)(6512007)(53546011)(6506007)(478600001)(110136005)(6636002)(47076005)(2906002)(5660300002)(44832011)(41300700001);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2024 21:44:31.1597 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 617e4200-ef3e-40c5-9464-08dc1b9350f8 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: AMS0EPF000001B3.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB5932 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 List-Id: On 22/01/2024 13:49, Richard Sandiford wrote: > Alex Coplan writes: > > 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. > > The new parameter should be documented. How about: > > // place. NEW_SETS contains the new set_infos that are being added as part > // of this change (as opposed to being moved or repurposed from existing > // instructions). That comment looks appropriate for apply_changes_to_insn, where NEW_SETS has already been populated, but doesn't seem accurate for finalize_new_accesses. How about: // place. Keep track of any newly-created set_infos being added as // part of this change by adding them to NEW_SETS. for finalize_new_accesses? OK with that change (and using your suggestion for apply_changes_to_insn)? Thanks, Alex > > > > 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. > > Similarly here. > > OK with those changes, thanks. > > Richard > > > 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 &);