From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2089.outbound.protection.outlook.com [40.107.104.89]) by sourceware.org (Postfix) with ESMTPS id F3ED93858D1E for ; Mon, 15 Jan 2024 14:26:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F3ED93858D1E 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 F3ED93858D1E Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.104.89 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1705328782; cv=pass; b=cErr7z5SM2SXvSJsXKdZZSbIR8mHurfzazppd7dJftrNPZlrQbay6gT9aMQUSI2YEWR3RAn0n5drWyp3W+c+TMCp2NvQeJXbC8+rYkR4HtA+k/+ofpj3Fl+FazX1Jb5hTiBrAHjG6ML1oFZkoy3TuVN9NRQWCbYaVbqLEjJGQEk= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1705328782; c=relaxed/simple; bh=uReMaQdPMlHixaqnYLJCA9QAseSP8HNs72Q5XrkNMKg=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:Message-ID: MIME-Version; b=QPV0PcXF77NlyzQuqSuSYUgo2utRHn+MSADZnuy7HDJSuIscuc7hLXGmbJqQUhGBS7vO8eHz4p1wyMpDPBrqnSOfPpx5HDCwUi1A6OE7K3qGwW+kd8f38CPsV4qRHAqaGsofXlhjY6bdbtN6i73XjeDeW7wq9j4T6tIy8+6NuvI= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=KhgsQ7LsHz95gB8R5AsqgMpefxbxLp3MD1lF2YfJLrk0QdCnlMpn9Xqo4y71yhm3EHKIxLl7eE50Xk1WW9o57MQW4eOfdQY2XkO2rK6gf2vtgbApqGUo/tfiShFr9AzlJ0Kpee7EcEH/BlBCAn4U1OqQ2da2NLYzC6eqj4d/LKu/hBnkPYrto+yXCdE0txQqNMYuQhLlrPGvN1lW2GOs6VMsfFUo+0HK/WQ9jFhkRovkAT45Qkj0w9OXy6UiQrHbXviiWOOEJ73sZPrCnbhzxbVJpj+JDxT/J2E5TfNAQLNk9LI68bp0Ip+1WYfK1gCLR41Bb5FDgiPaRi+EpaX0vw== 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=RsxeHkEdyhy6yFJj/U3FTaSBdD9rQUNXGj7z02hwn6o=; b=KfvJXZy+9v5ku3/LEAXLX5mUguU5F608piQpbAYFItStIZvyLnOTeRq0LrzqdHBPQrA0r4UVZsugqxNTnU3i6r62NnYF/reBmRiZWomBAZrGW+i4/o/Oe21nFXJCXzdPin0AsZ1+Ai2lk5frCaaledVl6BvCyJdeTRRZPJGft7LomingOrtM3xrGJtqefwYyq0APy/Sq5jtoE+8215CMona4Wd4HhpQOa8okmxeET5YGDRHy0KJlFppyy/4gmw2mayDY5JcoD2aQgwfZO0rXHVafUFGfx30rmbjDrZLjV+KDvamMTOBlRv+Tl+Y3uG3e+v7fiMnDISf39AhF+qLurA== 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=RsxeHkEdyhy6yFJj/U3FTaSBdD9rQUNXGj7z02hwn6o=; b=uXy/cWDjdBVLD4Br26d9UnJI0cRt5oeeuLfweLWos5+EnYuQ6mLInGPbKXCKnnsai3mLopFf9wXbxCC2DYepNZurtIHm3Xom7w4Vgt4TGLoHmQ4D/3lxoQgHf51liMHlQtpUNSWQYl60eRZ19L3vMX2aOEYyLhg97F09edrcPfs= Received: from AS4P192CA0010.EURP192.PROD.OUTLOOK.COM (2603:10a6:20b:5da::17) by PAXPR08MB7647.eurprd08.prod.outlook.com (2603:10a6:102:242::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.21; Mon, 15 Jan 2024 14:26:16 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:20b:5da:cafe::f1) by AS4P192CA0010.outlook.office365.com (2603:10a6:20b:5da::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.23 via Frontend Transport; Mon, 15 Jan 2024 14:26:16 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) 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, 15 Jan 2024 14:26:16 +0000 Received: ("Tessian outbound a297577ee0df:v228"); Mon, 15 Jan 2024 14:26:15 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: e456265a2786dafc X-CR-MTA-TID: 64aa7808 Received: from 1337e954922c.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 2D6CCB13-B9AC-4D5A-BFE0-90FC512D7E37.1; Mon, 15 Jan 2024 14:26:09 +0000 Received: from EUR01-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 1337e954922c.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 15 Jan 2024 14:26:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EWJ/KMlpxaF1OYTVJeuAAKVWfEBxbdz/2J/t7QD9Z8WBeaJA+bp33D7YKRqtjt8ABxzH8v0leoKGT1DQyjhwuoIx9UJyTc0M+Xs3O6IzGjLDxinuJW+Kz+O/SGnnApBrOeIYybaAX4vNxscoLEArvRZxNj3wEke2qsFzpj2m25FYLIOCzIfEM0/x78IHURQz9uTPlriC5MM6LnsYWTgAtcsMHBf6sXRcYdfcCbMsU3QP4xDFltYvSLmkiilZugEKTarzyGTQU+mE/iVsWMecHWJmXqoTW05U+5zgKLHiuoaLjJ0yrdADrv4z+x9KABKjTcHAobNdHNN+6QTiDKsBFw== 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=RsxeHkEdyhy6yFJj/U3FTaSBdD9rQUNXGj7z02hwn6o=; b=mDYlyqtBPOR+2WIP75nGgHtR12+5jww4Occ8jSs5ng4vJvuDUSrFxsYPbMAvemAANw89LYKZhpj0KWuxozDJ2QKDuidcN6MtTwQuKQu3B3y514wU/W9Pg84KffBSt0Q3yVHfNHE7eAYzqlOJUULF8segLgTvfncE+5SV4/Pu3BR8QgJGV6Fi1ffPqDMtvK98LHwSM9vYJ5MJjcUUh9v5pWtdChez1CncDEV+f4ryirMazr/3cJQdlPd3/P34yAXPHtywBwbmfxIQExMnXURSoweJwdsCqwK+a7WWS09mE4X5R9uNmqJTNtxRkR6DVghlko/HpUqy5yjy+o209NVe3A== 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=RsxeHkEdyhy6yFJj/U3FTaSBdD9rQUNXGj7z02hwn6o=; b=uXy/cWDjdBVLD4Br26d9UnJI0cRt5oeeuLfweLWos5+EnYuQ6mLInGPbKXCKnnsai3mLopFf9wXbxCC2DYepNZurtIHm3Xom7w4Vgt4TGLoHmQ4D/3lxoQgHf51liMHlQtpUNSWQYl60eRZ19L3vMX2aOEYyLhg97F09edrcPfs= 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 GV1PR08MB10370.eurprd08.prod.outlook.com (2603:10a6:150:a7::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.23; Mon, 15 Jan 2024 14:26:06 +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; Mon, 15 Jan 2024 14:26:06 +0000 Date: Mon, 15 Jan 2024 14:26:02 +0000 From: Alex Coplan To: gcc-patches@gcc.gnu.org Cc: Richard Earnshaw , Richard Sandiford , Kyrylo Tkachov Subject: [PATCH] aarch64: Don't record hazards against paired insns [PR113356] Message-ID: Content-Type: multipart/mixed; boundary="yCz60da+9yzDwwFT" Content-Disposition: inline X-ClientProxiedBy: LO4P265CA0088.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2bc::7) To PAWPR08MB8958.eurprd08.prod.outlook.com (2603:10a6:102:33e::15) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: PAWPR08MB8958:EE_|GV1PR08MB10370:EE_|AM2PEPF0001C715:EE_|PAXPR08MB7647:EE_ X-MS-Office365-Filtering-Correlation-Id: d3c9f9d0-9ad4-4cb9-a4d4-08dc15d5eeed 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: wS7BJv32LXmvEYphPyVCV7kyUiWKukvin5bFresCMa2egTpWO5wetGD8+ZBtftPqqiWOtGFNC9gYhR5vmfJ8kbRfnK7/e7pcLFvTa6NdA4sYKh3M6JKOyznqTCGbFEltya/h816vUXFdWUfzJWmgD9y9rmU0/lZk8WkSk7UU1TQcSMXg21EDIWpW28aOjomNlZtf8EQoygaHyLCSTugFZEyPzX3HEkIqwPoPnJ94LFGnVR/I4Y+WSI6qQcb33TBx+3af2vYjxn6IQw3UEoA2SJC/XDBC6iV3k64fnDNARcWoHNA/N6Jhw0GrHebDk6JWWbpHlerZus2vR3SYiKglAAM9C06LUJ9jwGL9X+6Vc3VgLRu0fSVW5wmN4LL1F+j85ECTAuZ/iaifLA0YEckVoGo1QaqDEeegnkDaZVb2IVcaATmaHkhxW5z3YctP8PRJRK5HuemdF72s1FxCRGXso7Q23AuZ3cNICKpmxNuKtbmewq0/mEUM0xKYjDdnSpStkbNYQDyfCFB1PdfI+ZPL4EYQqo3/JYfEl66eqgDwbczqkWdK6rjQfF7a4VbED0GOXs5+Be666Szq0J1q37At0uGMu388xx3uR+wF5+IFlrY= 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)(366004)(396003)(376002)(346002)(39860400002)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(84970400001)(21480400003)(83380400001)(86362001)(36756003)(8676002)(6666004)(44832011)(8936002)(4326008)(5660300002)(235185007)(2616005)(44144004)(33964004)(26005)(38100700002)(66946007)(66556008)(6916009)(316002)(66476007)(54906003)(2906002)(6486002)(41300700001)(6512007)(6506007)(478600001)(2700100001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR08MB10370 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 9545be74-cf1b-4fac-1e4c-08dc15d5e911 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OFTtvySmVgtYRrzjsqMpMaiL0SjT9LH4CerJlkmn5z2k1R+UTx2ELamb8qxy4KmWBL8xpvf/0Tw9oc7iLtXW96hEJeygzM1SJzTI7d5YnGI0kIvdX2supWnQthwOak9eGYUztOX6jOYqpYoGfiVUZTRBn/+5lxoDHpayOyWKEURZ+hi/Y3u915kClDRGPFKOPe2IThwhqq/Dtj//IRoJ05yxC49W6tZqt8b+dg1rUWhxOhXoWKmWi+PLzFgFB2mDP9IZSUE3isoWDzmhB8MD0l/2l3d+j5aCnS9Pj8AKtxKRwwwGGV74wDrX2zQI1VUVPPKKKWNggSlhU1Ekea5qBLnQOOm12Ipk+kIqDpmlcQgCSJqGRwp/u0YuebZRYei3VcMsZc3DTgmRpu/OG5YYQcryFkJVC2kIuzhHHxQbRUPc/fWSjmTYHKmV6wtYDzdUuQjO5fqEeyXbvBGqS5OS1pb0ZiVUC2NTFhmA21M7J3RG+gOMHLA9RkCFzhBj6g1jklXhvqfEl9Gmv/hnRnkSNCibARHE3DFrTxftJoNOt8iEULlyEtRhDN4RfF8anece1ox+rAMGUET1142GvxHdn4w7MZEqsazCUbCg08ZW7OJpGAIz/vLRQK5jr/72aiHJzYnOwV6mxPYwR7Mp32k8PhNtqN//khT9fWIpO/URPuvq//Cy45bc8j1xgPFHwHzifp0xWDyoAQH3ffI/tl4jspErOiHSLhhKmdFkSlIn+pkaWztJwg6UjyZlzbX/ywer 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)(346002)(39860400002)(136003)(396003)(230922051799003)(1800799012)(451199024)(186009)(64100799003)(82310400011)(40470700004)(36840700001)(46966006)(83380400001)(336012)(2616005)(26005)(54906003)(82740400003)(235185007)(70206006)(2906002)(47076005)(8676002)(44832011)(4326008)(44144004)(5660300002)(6506007)(6916009)(8936002)(478600001)(33964004)(6486002)(6666004)(316002)(41300700001)(70586007)(36860700001)(21480400003)(6512007)(81166007)(86362001)(36756003)(356005)(40460700003)(40480700001)(84970400001)(2700100001);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jan 2024 14:26:16.0067 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d3c9f9d0-9ad4-4cb9-a4d4-08dc15d5eeed 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB7647 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,GIT_PATCH_0,KAM_DMARC_NONE,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,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: --yCz60da+9yzDwwFT Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Hi, For the testcase in the PR, we try to pair insns where the first has writeback and the second uses the updated base register. This causes us to record a hazard against the second insn, thus narrowing the move range away from the end of the BB. However, it isn't meaningful to record hazards against the other insn in the pair, as this doesn't change which pairs can be formed, and also doesn't change where the pair is formed (from the perspective of nondebug insns). To see why this is the case, consider the two cases: - Suppoe we are finding hazards for insns[0]. If we record a hazard against insns[1], then range.last becomes insns[1]->prev_nondebug_insn (), but note that this is equivalent to inserting after insns[1] (since insns[1] is being changed). - Now consider finding hazards for insns[1]. Suppose we record insns[0] as a hazard. Then we set range.first = insns[0], which is a no-op. As such, it seems better to never record hazards against the other insn in the pair, as we check whether the insns themselves are suitable for combination separately (e.g. for ldp checking that they use distinct transfer registers). Avoiding unnecessarily narrowing the move range avoids unnecessarily re-ordering over debug insns. This should also mean that we can only narrow the move range away from the end of the BB in the case that we record a hazard for insns[0] against insns[1]->prev_nondebug_insn () or earlier. This means that for the non-call-exceptions case, either the move range includes insns[1], or we reject the pair (thus the assert tripped in the PR should always hold). Bootstrapped/regtested on aarch64-linux-gnu with/without ldp passes enabled on top of the PR113070 fixes, OK for trunk? Thanks, Alex gcc/ChangeLog: PR target/113356 * config/aarch64/aarch64-ldp-fusion.cc (ldp_bb_info::try_fuse_pair): Don't record hazards against the opposite insn in the pair. gcc/testsuite/ChangeLog: PR target/113356 * gcc.target/aarch64/pr113356.C: New test. --yCz60da+9yzDwwFT Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="patch.txt" diff --git a/gcc/config/aarch64/aarch64-ldp-fusion.cc b/gcc/config/aarch64/aarch64-ldp-fusion.cc index 703cfb1228c..6834560c5fb 100644 --- a/gcc/config/aarch64/aarch64-ldp-fusion.cc +++ b/gcc/config/aarch64/aarch64-ldp-fusion.cc @@ -2216,11 +2216,11 @@ ldp_bb_info::try_fuse_pair (bool load_p, unsigned access_size, ignore[j] = &XEXP (cand_mems[j], 0); insn_info *h = first_hazard_after (insns[0], ignore[0]); - if (h && *h <= *insns[1]) + if (h && *h < *insns[1]) cand.hazards[0] = h; h = latest_hazard_before (insns[1], ignore[1]); - if (h && *h >= *insns[0]) + if (h && *h > *insns[0]) cand.hazards[1] = h; if (!cand.viable ()) diff --git a/gcc/testsuite/gcc.target/aarch64/pr113356.C b/gcc/testsuite/gcc.target/aarch64/pr113356.C new file mode 100644 index 00000000000..0de17a54a53 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr113356.C @@ -0,0 +1,8 @@ +// { dg-do compile } +// { dg-options "-Os -fnon-call-exceptions -mearly-ldp-fusion -fno-lifetime-dse -fno-forward-propagate" } +struct Class1 { + virtual ~Class1() {} + unsigned Field1; +}; +struct Class4 : virtual Class1 {}; +int main() { Class4 var1; } --yCz60da+9yzDwwFT--