From patchwork Fri Jan 5 11:48:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Coplan X-Patchwork-Id: 1882856 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=LWLyLeTO; 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=LWLyLeTO; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; 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 (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 4T61w673yGz1yP4 for ; Fri, 5 Jan 2024 22:49:42 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ED61F385DC1A for ; Fri, 5 Jan 2024 11:49:40 +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-db5eur02on2067.outbound.protection.outlook.com [40.107.249.67]) by sourceware.org (Postfix) with ESMTPS id DEA92385AC11 for ; Fri, 5 Jan 2024 11:49:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DEA92385AC11 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 DEA92385AC11 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.249.67 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1704455351; cv=pass; b=dXBFFLph1nFn8lbc5rwi27oiveVIK+lgS5eYq8mA+T+lXJ+vd8+DPAPdORqFCDjymsANR+O4GVVNTfcuGmYEr5dxrnKv6brzSJubKAvPrPYZAvl5StpjMDGEeD5rpXYDIeqWuB/JHhXj0PyghaBgIS/n7ZLUZemBnQuLeODbqic= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1704455351; c=relaxed/simple; bh=Zac3GEMMukCQHRb4sSJjZpsv6mAoaMAPwrMC+e0lOtI=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:Message-ID: MIME-Version; b=Sx2/Bek09+WaxpFuAXs0CO7eNdh8o0oOMwnGlcdV+iFc6Qurc+rjS7iV4+sYy17jun4KtjgHmkAJha8Bv5dXV0ceD0nAgAjXT+XTyJUCV8M8iH0gSXJAjSKxkcDjVm2Ap5J2z+fjWLcA8xtrL0UJIKiarmSDht/UHzELd4lRY18= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=dUiHxrqeHORu0Z6WFjYukbPnM3bz6B8TC9KY5/6/HtWnKm81H49YsKtgk7VKEkcdPKKuuO3X5I+gnRla51EqsoTjcq8ykOs6OkKMPVHjVSJKd6qhUkn9PQp8maissRxnNWUmK9jMygixN9NhiLzVN5pXr2IHBgugmEK5kjSxnDxtr50WBOPQxONRAH2BK7iVcYDjTLZ4SZAEzkvpttB3pR6r7zNCa05qsshE+NON8xvkE/Yd3pUOfDc1F0afU+sIhH/pYp47qAN89ua611G95kumLnBfpnjG6gvZwiCnINlgB4xhldYfoj9CwosXrsuMPMmBTuuCunLi+Eo4hmhDdw== 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=SYvgMRRD7V7ZNgeEBEdE1x/YjrrVR2Vsy0vWFZAZDGg=; b=h/hBeefivhnAWgjoNHn1W4KMjHjKnysCWlXT8YNv5vgyFLCWf0osTm8nO94J7sfJkJNP14GlmtlTaBhjWwU62SPMwCbke5OSz9qJ/e41N1fqzBgZdzwhEDdJrAW9S0CR/VKXnsqZs6hFKbRzK2EszXumhfXfDxfV85mHIieuJML8mQaCSar8uvZkoU2x47qaBNfTo+MbARMjC0HwtBKiaK/+6oXSIWhzYmJ87lwvLy5sbuE9bFI/DMwDPeIKe2cO8DS481Q8ftfoppDOVnjPdnzSwFgmN//ScQv59VCY/vAzbB4cEfTxLkrLvqual+CMhRn7fJQL/6z9NcrIipH6qg== 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=SYvgMRRD7V7ZNgeEBEdE1x/YjrrVR2Vsy0vWFZAZDGg=; b=LWLyLeTOAyN5txdv4FimEZKHnZKFjPAfEpU+zG2I8QeWdS7E8Zlpiz/+X20vYcwTAoi/ZXD+WTdstImIsqrdhlfiPFFlDci9ZxjZPi6x1yFzrja1YqUxVFYvnIU3dVx2tCHB22jaKHkvQzYiUut+SeQfpdvX0yxYFJnW/JXBavc= Received: from AM6PR0202CA0050.eurprd02.prod.outlook.com (2603:10a6:20b:3a::27) by GV1PR08MB8354.eurprd08.prod.outlook.com (2603:10a6:150:a4::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.15; Fri, 5 Jan 2024 11:49:05 +0000 Received: from AM3PEPF00009B9D.eurprd04.prod.outlook.com (2603:10a6:20b:3a:cafe::9d) by AM6PR0202CA0050.outlook.office365.com (2603:10a6:20b:3a::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.16 via Frontend Transport; Fri, 5 Jan 2024 11:49:04 +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 AM3PEPF00009B9D.mail.protection.outlook.com (10.167.16.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.9 via Frontend Transport; Fri, 5 Jan 2024 11:49:04 +0000 Received: ("Tessian outbound 53c3c09c1e1b:v239"); Fri, 05 Jan 2024 11:49:04 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 98987244f191a9d2 X-CR-MTA-TID: 64aa7808 Received: from 69358ef14769.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id AF0421C8-ABF7-4A4E-8D7F-CA299C362D9C.1; Fri, 05 Jan 2024 11:48:57 +0000 Received: from EUR01-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 69358ef14769.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 05 Jan 2024 11:48:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fOXCvxJfw0Tl/tmuVRCqqcDOVhmmZms4YItk2jCeCbKiANZr6hBPu6YFwqmpcIy0mUuni1mtDe5PM+zspp9yBSdzcp6vGXQk1e/MEHpxdhZJdd6FYn5xMjODi8xbxUn88gVQ5euBmARDdyk6cBhhxiOKzBO4fAh7aLkWZzkT4xxb06RU8q+9+aikbQ1h2WSTgPOWMSRSb+thxJhhVksp3cy+0+EPIFmKiQOngqLYLcW96l7Y4bH8G3fHst0OfakZDY6sWo7DHjA60Ius++EXt5TjMHpQbtAo+rlknOY+s1j0cJXMkiKZJdT4Ezq5gPkNEIlHVJyyz4viIEFWQ2jKIA== 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=SYvgMRRD7V7ZNgeEBEdE1x/YjrrVR2Vsy0vWFZAZDGg=; b=jZtP8bZqSbITbjG25pGbcrpCApNpTPo2j0MQAOZ8NM1QZdcUx5pO9yQYRlwp0heLq7RYHJsfEQKgCPs/S/lLRQKPVHozTdPvUhcxOHsLseLJIqYB6+WJNLQyu7TlQziWDUcVv2s9UoEgJWm7aUHeXjh7/KqcpBjv4+X0FP5PTnOQH2Ztl7J0Bf23GvVcyJr3WdS49BdfQU5h3vsBb8Jc8MvH2A2ahQjki50JnO5Ni0YEMt1jI8J633s7X+/FZXVV4uMLmK4jDGQ3o1YNF2AUNBQhGA1o4BpSHnnuls5GktTqk6cw+WKRGdRFsUOQx7rpR0LJU/rJQT8Q5uKfgf10Bw== 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=SYvgMRRD7V7ZNgeEBEdE1x/YjrrVR2Vsy0vWFZAZDGg=; b=LWLyLeTOAyN5txdv4FimEZKHnZKFjPAfEpU+zG2I8QeWdS7E8Zlpiz/+X20vYcwTAoi/ZXD+WTdstImIsqrdhlfiPFFlDci9ZxjZPi6x1yFzrja1YqUxVFYvnIU3dVx2tCHB22jaKHkvQzYiUut+SeQfpdvX0yxYFJnW/JXBavc= 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 DB9PR08MB8738.eurprd08.prod.outlook.com (2603:10a6:10:3d2::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.14; Fri, 5 Jan 2024 11:48:54 +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.7159.013; Fri, 5 Jan 2024 11:48:54 +0000 Date: Fri, 5 Jan 2024 11:48:51 +0000 From: Alex Coplan To: gcc-patches@gcc.gnu.org Cc: Richard Earnshaw , Richard Sandiford , Kyrylo Tkachov Subject: [PATCH] aarch64: Further fix for throwing insns in ldp/stp pass [PR113217] Message-ID: Content-Disposition: inline X-ClientProxiedBy: LO4P123CA0044.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:152::13) To PAWPR08MB8958.eurprd08.prod.outlook.com (2603:10a6:102:33e::15) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: PAWPR08MB8958:EE_|DB9PR08MB8738:EE_|AM3PEPF00009B9D:EE_|GV1PR08MB8354:EE_ X-MS-Office365-Filtering-Correlation-Id: 5a83f161-54cb-44df-d30c-08dc0de45151 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: lBoGLinz5P5SXLF6gbmBMYV3ytNZkAi1EXWeT15TyIgngQq2dNt1u5MoDWalm06rhyAUdFZ/Q9Zu3xw7zpTFZdM6neNLE5vtACUICeYTvTT1ImdXATgi4giC53v+ZWM4hkruAOXGaerpGHfhb0lBvZmtvoSkAOgWwiG3F8ctnpKsLB52OUleDKgLG8gWyqEtJWgLh7uLiLlWPNFXIhAQUr3IHp0Z3nmAcOe7JNwUpMDEDz9odBYIXtDXrzXN75odh8VDZdIIryqRrId/0m5RNDMmH0pCYTRvUBbPARlH/cGePV3UbMbfWW6+NzeymOoHxIG2KvACZ0lscdPjL7jO6cy1sgOnPN0+BIKemtIyPlrjn+7Z+e7nwNNaurGY5M5QhKEmnherZdjm9vYJgSIi+P67W2HNUI6kcyVAHMTx0CU+gu+8PvqSvz4Dh0V+IuO0gFqoX+WQtnMkNr+lILC+t8KQwrwTri63gWa02AxUloVuE3EXlD6JVczSgZ0G7h7aXERxPupbULta+3dlRd6yCw5cpp+SU4ZaF7wkMy1UM+yZVAVsTUJ4vqOvhZtNBawiDMJnIraPerAywQkK67BBuY//S9SQD4uJmtje9kVBoYUnxOgoPIfBkKTRpAA2groB 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)(136003)(346002)(396003)(39860400002)(366004)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(6512007)(6486002)(8676002)(478600001)(6506007)(33964004)(44144004)(6916009)(6666004)(8936002)(54906003)(66946007)(66556008)(66476007)(316002)(4326008)(2616005)(26005)(83380400001)(21480400003)(44832011)(2906002)(5660300002)(235185007)(41300700001)(38100700002)(36756003)(86362001)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB8738 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: AM3PEPF00009B9D.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: ca11f7d0-4919-43a0-744e-08dc0de44aee X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0whFRfoj8ZQrPScVxvg6Whd4JF+Cfr4V7pF30nGe/9cHKJCyurl1j/NNhYbKPGYZCj255gnkeNhUwdeXaKGdx2lmPMqR/CEJ6Xz4RaElGi+QC5xr+OXpFGb3QxMnIr1tGcc57/QRT0AUi214rstmz0fo9dhSNgX5mJxjqWpLM+fOxUcHh1Z7/FgMFM+AkRL5Nl2ZWkXxHv4g9Ls9SOmi8kQzB7h/7r4CjybgTfAO6JVK/orAEE1eRzDQHxFupflrIB5zdokJKX7mb6mb0HqK6IYbcMZLHih5y+ZyZyegu94tEmHnnxMU1MBkIxC3x/Eb77botDXTOKwY719RsHoja0z9rL3VzGnKkJDniGarjOQZbGyZGjwfCNxQsVShicENCWZjwCwrwWrVsf9XH12aMFqEVMGpSs0ZpQVKf7b/2kPTruAFZIIe39R2mwkoivDiFN/cKqJETGshC3uxGc2xnl2P1MLe2IwMW0zrzZ7xQVUL8SUJ0qLxrJsuki01bB52eNApg6YRIXnxc9Rat65+riHE6yTrCkzAnU9uZUhKiYv0gykz05cXJ8E+aJ9dhbB+8Y+xXRTyXR60kA2i6NZ+c6eyqB2+3ZmDU3FfnDeygTvTDvcn1WepXl5HO1sjX7Z6UmI0z/KeDozyaSmks2dN6Lra5hGKsrAYnN3/MX+NJtPknerZYn6icHlEfxmdzPJNITsKmBUEFCucUKWwjlTSLLBjczYTk2N473RqBmxOLjl0jHN87jehx/GiFrLmmP+651w7D/0K8dtmygO10MVGig== 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)(376002)(39860400002)(396003)(346002)(136003)(230922051799003)(186009)(82310400011)(1800799012)(64100799003)(451199024)(36840700001)(40470700004)(46966006)(356005)(33964004)(81166007)(6512007)(6506007)(2616005)(86362001)(44144004)(478600001)(6666004)(70206006)(70586007)(6916009)(54906003)(6486002)(316002)(47076005)(36860700001)(83380400001)(82740400003)(40480700001)(21480400003)(40460700003)(26005)(336012)(8676002)(5660300002)(235185007)(44832011)(4326008)(8936002)(36756003)(2906002)(41300700001)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2024 11:49:04.7320 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5a83f161-54cb-44df-d30c-08dc0de45151 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: AM3PEPF00009B9D.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR08MB8354 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+incoming=patchwork.ozlabs.org@gcc.gnu.org As the PR shows, the fix in r14-6916-g057dc349021660c40699fb5c98fd9cac8e168653 was not complete. That fix was enough to stop us trying to move throwing accesses above nondebug insns, but due to this code in try_fuse_pair: // Placement strategy: push loads down and pull stores up, this should // help register pressure by reducing live ranges. if (load_p) range.first = range.last; else range.last = range.first; we would still try to move stores up above any debug insns that occurred immediately after the previous nondebug insn. This patch fixes that by narrowing the move range in the case that the second access is throwing to exactly the range of that insn. Note that we still need the fix to latest_hazard_before mentioned above so as to ensure we select a suitable base and reject pairs if it isn't viable to form the pair at the end of the BB. Bootstrapped/regtested on aarch64-linux-gnu, OK for trunk? Thanks, Alex gcc/ChangeLog: PR target/113217 * config/aarch64/aarch64-ldp-fusion.cc (ldp_bb_info::try_fuse_pair): If the second access can throw, narrow the move range to exactly that insn. gcc/testsuite/ChangeLog: PR target/113217 * g++.dg/pr113217.C: New test. diff --git a/gcc/config/aarch64/aarch64-ldp-fusion.cc b/gcc/config/aarch64/aarch64-ldp-fusion.cc index 25f9b2d01c5..2fe1b1d4d84 100644 --- a/gcc/config/aarch64/aarch64-ldp-fusion.cc +++ b/gcc/config/aarch64/aarch64-ldp-fusion.cc @@ -2195,6 +2195,15 @@ ldp_bb_info::try_fuse_pair (bool load_p, unsigned access_size, if (base->hazards[0]) range.last = base->hazards[0]->prev_nondebug_insn (); + // If the second insn can throw, narrow the move range to exactly that insn. + // This prevents us trying to move the second insn from the end of the BB. + if (cfun->can_throw_non_call_exceptions + && find_reg_note (insns[1]->rtl (), REG_EH_REGION, NULL_RTX)) + { + gcc_assert (range.includes (insns[1])); + range = insn_range_info (insns[1]); + } + // Placement strategy: push loads down and pull stores up, this should // help register pressure by reducing live ranges. if (load_p) diff --git a/gcc/testsuite/g++.dg/pr113217.C b/gcc/testsuite/g++.dg/pr113217.C new file mode 100644 index 00000000000..ec861543930 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr113217.C @@ -0,0 +1,15 @@ +// { dg-do compile } +// { dg-options "-O -g -fnon-call-exceptions" } +struct _Vector_base { + int _M_end_of_storage; +}; +struct vector : _Vector_base { + vector() : _Vector_base() {} + ~vector(); +}; +struct LoadGraph { + LoadGraph(); + vector colors; + vector data_block; +}; +LoadGraph::LoadGraph() {}