From patchwork Tue Oct 17 20:46:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Coplan X-Patchwork-Id: 1850484 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=rfDJPivF; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=rfDJPivF; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S95cN2Mjzz20cx for ; Wed, 18 Oct 2023 07:46:28 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5A20A3857704 for ; Tue, 17 Oct 2023 20:46:26 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2057.outbound.protection.outlook.com [40.107.249.57]) by sourceware.org (Postfix) with ESMTPS id AFC53385800A for ; Tue, 17 Oct 2023 20:46:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AFC53385800A 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 AFC53385800A Authentication-Results: server2.sourceware.org; arc=fail smtp.remote-ip=40.107.249.57 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1697575574; cv=fail; b=o73CWlPIUhn+CAd5DnVTP++73OHFCdG0iM/5HOjWgAM0Y96jHAAlhQ4K4ocTAvhAAxRAd3wbkxYV7AXwjO4uXmpEGFHnnBG2lIJx+5A1ILYa2pyr/cdk563y/FPDhWSsQGxs5iDJnjdhxnuQhwXJlNXOL3LDA/j81I09bl8OOmI= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1697575574; c=relaxed/simple; bh=vtVM8LKgR5OFsGjjSWev5BHss0CyCuKy/iDasRPoHNI=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:Message-ID: MIME-Version; b=t6sCMvkalsDWm7uT7oHzm//XjYJa5m5ftCSgbrm6c3pSA+eoqN6kDPzSzF/YWiWw+i32CMFXlUkP9fmI9BrUJYjUAIiFJ8GLVEsubzrLexE8R9rTxy+T3iCX0OAZ7/OxAjVsDgY7SwGplW2lCqJc9d0uAf8OrC4uQ2lMZOQcs1E= ARC-Authentication-Results: i=2; server2.sourceware.org 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=5P8hJwDL1JhUnSaKPHougSKXwL9bTUQDZCIy6wQ8MFk=; b=rfDJPivFzNDquubkqgcTOed8CQDJq23KTpJJRup1Q3Tu5raAuCgW20LIpI+a4iREeTwOae85pZFCbv9qgHQSYhSh7rP6c0qByr6NzU3qDQgtr4ox375orbYvCiUzMz71IPP3Us3+2zgHwxgRkTlXbrEUg+39fN6F+HiMkCN6JFo= Received: from AM5PR0101CA0030.eurprd01.prod.exchangelabs.com (2603:10a6:206:16::43) by DB9PR08MB7511.eurprd08.prod.outlook.com (2603:10a6:10:302::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.46; Tue, 17 Oct 2023 20:46:11 +0000 Received: from AMS0EPF0000019C.eurprd05.prod.outlook.com (2603:10a6:206:16:cafe::33) by AM5PR0101CA0030.outlook.office365.com (2603:10a6:206:16::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36 via Frontend Transport; Tue, 17 Oct 2023 20:46:11 +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 AMS0EPF0000019C.mail.protection.outlook.com (10.167.16.248) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.20 via Frontend Transport; Tue, 17 Oct 2023 20:46:11 +0000 Received: ("Tessian outbound ee9c7f88acf7:v211"); Tue, 17 Oct 2023 20:46:10 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 8eef24a4ec65b7dd X-CR-MTA-TID: 64aa7808 Received: from e0c4d2d2dff9.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id BC5BE59C-655B-44AA-AFC7-5D9D835C6582.1; Tue, 17 Oct 2023 20:46:04 +0000 Received: from EUR01-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id e0c4d2d2dff9.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 17 Oct 2023 20:46:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=amB8CdFg5eUcoC77oBseIe+3vRPAoocIl1xzsYJWpiKHAypNxb6fXnEsaziEOSKb1gbG1iYM+KIUBHrg+fwxgE+5aHYTYMwbGOsSuHWG8nJENzt7YfCt0PL6NWBsvpeaTtboM/37s2h7QP9EEIVwmLAXPsCWgT8tcque49o0M9UXspBgKMUjBJn5orEd9aoz0/DDBalvmEkVMxhamXSXn+viOHOyk+JwNmzOPwlYDDTTJ9Yu9HI0je6OQVpoJbAxTu4Xts9A3G6xw0dB/5+gdU6irjuNPpBDpAKTTqZ7Ak6pCuAgyrkmmFMmSVqnDkgpKEzGiGiEB58E9Dv16/didQ== 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=5P8hJwDL1JhUnSaKPHougSKXwL9bTUQDZCIy6wQ8MFk=; b=MBCFpDeJoG9yrUi2cwtwcqCosYEHb+IB6iyG4PZdpemfvMZbjZHgmmHd9WLux9kYUgo6zkJCyGA120NnP/qW0NRbhuDlnKC0F+4VXJQLpbDU1z600+YBlNF0e8Ey8ZmNXyID0xPY8KQfzIaaWBPjXQsn4lUDLUV87Xc7faD0AO10mA7zd6bSz5X4PxRwgYBo5Xqbu0eSZLZ7PeAoiXabG/KnBeI3RCcPHzBNHYCTau2xMWl/8x/ObzGejK7Uc/FCNTuVknBSHrYNxP0CK5HN6CoTWZdmN/vIvPO++A5j4M7cZVBE7OJ+IUoDBKZYM89G47369v0T/7nlWlU0Qnlm2A== 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=5P8hJwDL1JhUnSaKPHougSKXwL9bTUQDZCIy6wQ8MFk=; b=rfDJPivFzNDquubkqgcTOed8CQDJq23KTpJJRup1Q3Tu5raAuCgW20LIpI+a4iREeTwOae85pZFCbv9qgHQSYhSh7rP6c0qByr6NzU3qDQgtr4ox375orbYvCiUzMz71IPP3Us3+2zgHwxgRkTlXbrEUg+39fN6F+HiMkCN6JFo= 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 AS4PR08MB7580.eurprd08.prod.outlook.com (2603:10a6:20b:4ff::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36; Tue, 17 Oct 2023 20:46:02 +0000 Received: from PAWPR08MB8958.eurprd08.prod.outlook.com ([fe80::f41:4ae1:dba2:70f4]) by PAWPR08MB8958.eurprd08.prod.outlook.com ([fe80::f41:4ae1:dba2:70f4%6]) with mapi id 15.20.6863.046; Tue, 17 Oct 2023 20:46:02 +0000 Date: Tue, 17 Oct 2023 21:46:00 +0100 From: Alex Coplan To: gcc-patches@gcc.gnu.org Cc: Richard Sandiford Subject: [PATCH 01/11] rtl-ssa: Fix bug in function_info::add_insn_after Message-ID: Content-Disposition: inline X-ClientProxiedBy: LO4P265CA0189.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:311::15) To PAWPR08MB8958.eurprd08.prod.outlook.com (2603:10a6:102:33e::15) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: PAWPR08MB8958:EE_|AS4PR08MB7580:EE_|AMS0EPF0000019C:EE_|DB9PR08MB7511:EE_ X-MS-Office365-Filtering-Correlation-Id: 27bbd254-6c52-48f4-4b49-08dbcf5218c1 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: yVkQrlLHA4MiQH4ik7AwKBO7sxw6zZHxksIC0iXYdEntIr7gls4iNFv5h8l5yIVsV2X4MQl4gIaMlxVuvSMWpRmuzzvYEqtvSJi0IMopvYiAM6lyetEpfevKNJOqHBQwaogG2u0tQTixvHtR4OzDGS5s3hBJicM6JafY1Exin8vxvudK80rKcYW2lJ1DmIS5lgUubI448OYsadnI4hAZAlcnP8Bs3trnSedYwuCSQ7XML3Ia1jor9m0Zq8AzHN7lXMj3eToo7VuToCFSFDHEItXj3Sb/yblIBw43CrQCT2watXs1pWrMyObIi/gvKC6QZiqAHAeDD3VHzI4F/qhQNKOQgaKc45K38oez4rjJ+037Kw4UI6xLSVK8qg1pUVj6FYRwpndieR/SvuC2S7ay+t6jou9BwiB0TPzrZFAmE43yLGBct4psEftd20ROtBCijrxSkWkWfYrnJhpIo0x0uYAvhmc/LKAVW5jQiInkJLPMKSCV5PC6OFyCG7JMzB1ejDcc5rAo2KWnlT2IvrQoXA0AV9HnO4XM0B/BdxVeHQjO1b9tXOh9Cp5Skp6aFiGcTdxQu39clfopxe2aKq8eIhCP5YPFuq0l12y3s06LU4el1UMhDBBx0nDJEzUqq5ZM 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)(346002)(396003)(366004)(136003)(39860400002)(376002)(230922051799003)(64100799003)(451199024)(1800799009)(186009)(316002)(66556008)(66946007)(66476007)(8936002)(8676002)(6916009)(38100700002)(6512007)(478600001)(2616005)(6486002)(44144004)(33964004)(6506007)(83380400001)(4326008)(26005)(235185007)(2906002)(5660300002)(44832011)(86362001)(41300700001)(36756003)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR08MB7580 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: AMS0EPF0000019C.eurprd05.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 135fe0f4-98f2-4be8-3689-08dbcf52137f X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HxSjx5g/wmdRPmCTzEA+p0JBNKci1fuzNXlFgcK9nVVZfmbwuzCXCdneq1POdSm2PwGVqcYDWMxEXYqYMcFrME903iBj+Ypgqf5YZaH68HQSo0i/PQ0E1NYH9utnpyyXhRvBQP/KqWV2WaZiKfZPMWx7GeGce6F17BRI9lpi+sJhdxxpU7MoRUmA/9K//Wyk3E5Rtendumu3cXtxcUTJWRRpaJDXeoZuV7+btzs1eOSyFueGWmkYDMsdl1CVfoTeOHniI2IsBbv89ouYA/vt5yHHLx8OwE9GzP1BagaRb1FCDeTVgh3ApQAZWLFfDBCZ1G1tlYaSpKj5x1XeBvFv2A1mDd8duNlcLoEKqhW55+bahypMcF0OJ1ngdA1mulEu/eg7CCbfwJijSY9tvsPA6HgBU0hBssypQ3nFYRG9O2kRNi+m5GFkOAYHxAU6WFKx9cmV7X/fnxRJxu6Q2ogBDe4+9YNY9gLWG6KRc1xMAim8QZyIP47ZkseoBoKJQnoGh430/0w+3ZQk92FuQvthcVjZoJkACkDauwmdpQ/27mnWKH4qxr4depA/bmmvtFDBGKE9UhvqkDheO1ZMi+ZjGAdfA6ctRxOfsZo8aEMPcrOZJwH7Veema4lZUlrSb5/wTZdNhbA48P8OxqVV0Nh69K86L8q025hkTjmSeuAsUjgwlsySI060d5VsUa3SxTTWYLZY+saXhjsa+EvEVHEI0o9OEiRJj68zeqfIeNh1lxEXqnMIXRPM+JWgwASPTyEny6+qy/ukywV6ztmF724o7g== 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)(396003)(39860400002)(376002)(136003)(230922051799003)(1800799009)(186009)(82310400011)(451199024)(64100799003)(40470700004)(36840700001)(46966006)(2906002)(4326008)(8676002)(8936002)(6916009)(70586007)(5660300002)(235185007)(316002)(70206006)(6486002)(478600001)(41300700001)(44832011)(6512007)(6506007)(40460700003)(47076005)(2616005)(26005)(336012)(36860700001)(83380400001)(44144004)(40480700001)(33964004)(86362001)(82740400003)(36756003)(81166007)(356005)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2023 20:46:11.2020 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 27bbd254-6c52-48f4-4b49-08dbcf5218c1 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: AMS0EPF0000019C.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB7511 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, 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+incoming=patchwork.ozlabs.org@gcc.gnu.org In the case that !insn->is_debug_insn () && next->is_debug_insn (), this function was missing an update of the prev pointer on the first nondebug insn following the sequence of debug insns starting at next. This can lead to corruption of the insn chain, in that we end up with: insn->next_any_insn ()->prev_any_insn () != insn in this case. This patch fixes that. Bootstrapped/regtested as a series on aarch64-linux-gnu, OK for trunk? gcc/ChangeLog: * rtl-ssa/insns.cc (function_info::add_insn_after): Ensure we update the prev pointer on the following nondebug insn in the case that !insn->is_debug_insn () && next->is_debug_insn (). --- gcc/rtl-ssa/insns.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/gcc/rtl-ssa/insns.cc b/gcc/rtl-ssa/insns.cc index a0c2fec2b70..f970375d906 100644 --- a/gcc/rtl-ssa/insns.cc +++ b/gcc/rtl-ssa/insns.cc @@ -291,9 +291,17 @@ function_info::add_insn_after (insn_info *insn, insn_info *after) first->set_last_debug_insn (insn); } else // !insn->is_debug_insn () && next->is_debug_insn () - // At present we don't (need to) support inserting a nondebug - // instruction between two existing debug instructions. - gcc_assert (!after->is_debug_insn ()); + { + // At present we don't (need to) support inserting a nondebug + // instruction between two existing debug instructions. + gcc_assert (!after->is_debug_insn ()); + + // Find the next nondebug insn and update its previous pointer + // to point to INSN. + auto next_nondebug = next->last_debug_insn ()->next_any_insn (); + gcc_checking_assert (!next_nondebug->is_debug_insn ()); + next_nondebug->set_prev_sametype_insn (insn); + } // If AFTER and NEXT are separated by at least two points, we can // use a unique point number for INSN. Otherwise INSN will have