From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2047.outbound.protection.outlook.com [40.107.21.47]) by sourceware.org (Postfix) with ESMTPS id 82F753861003 for ; Tue, 9 Jan 2024 13:26:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 82F753861003 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 82F753861003 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.21.47 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1704806817; cv=pass; b=VsOw9AAy+lywrOlXbsRVtk12KfaIBElrRG6h2M/+rV0BqhJPuYUKU0m37xzBjzn30bRq2izaXzZoAaw/GoWLBPZKbfC7D/wlIALtcZHeJesKmZuk/0N+c8uzYrIykfEZxgOoyw2/CGOt07CRynyjFJZgMSVncALY5kStvicICSg= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1704806817; c=relaxed/simple; bh=FXJOcI/4WKMUGzh1INYi3RWEvz6dnXnr99cvlTzSRds=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=urU2F+wTvhs1Jrx5lGZsFXtw2lJpUPiANSECHbXKEZDkQWy3LKVnDbAnqGAFh9D7uomLQPZv60MddaxT2DntL5Aw3hravDCZ6yAtob0WE9efjfKPUxcqAsSs5Mwt/nb1pViUasoFWl+pa/Gr7XnhP6nH09KJ44LZmj29dJDDzvE= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=k2xn6R3u/R6UYYfH6/DDG9URrYqgkefb83FHUlV++warC6BUj2ZlqGImtZCXiARQmY59h2wg8zFxUeIYM0wDLyjpK0scdSg8AWRmrNvTrlFB6ct3Hb7ubBezPWnDR/cGPkgWkVaxr041/WhEukKsgjnDQO3K0O5ZvzW2hDSTarAGUtDSqMTCsPd/IyDR5o0X108/PJ/h2jXL/T0ZwSuw8RR7eiZ7Ac9+DlnVymn4y4hUI6fZLBhJ2PSY4K8E1ReySMt9j66AeWLCKooT2srEBwZ7rjeGegFGzjC35LNV2W2HLfiZM0E/sdbVbjQ3AyXs0Le1IN4pV1i2XyHVYqxs9Q== 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=wSMuT0Ztqzz5ohUfQoUxqxnGaFwjhA+G3WNyJyPiifU=; b=TSqx/heLAtyyzTqQpNE3A/yBb5R8GI2z4k7DJnpyv/xD7HOofBV1JQHkqZWjKDpvPHfN+T+Jr8+WvesgIoV6WxzRWVgCYiePvSd9pP+E0l3AsUrO/dWw67jttVcQ7XAfxMJ+7XDbvye9kAykrz9Zc/PMpmZxZVaPIzNCYyNoAG8uIRJwTK5+o4hBbtwDCPwFVULCRKMHvDlSUaMY/H9R5agKFlXnj7B0CtoMI9fYeDl3r1sx2DfV7LX5mMzHjIqnLNorMbtaCrVtJh8Pe1otRgCD94utRgp+WIyo5WdUA29IRPPR4ErZbAdaErI0EYP34VSEKxVbKuIYh8Oh/PE8NQ== 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=wSMuT0Ztqzz5ohUfQoUxqxnGaFwjhA+G3WNyJyPiifU=; b=xMhaGDtk910/GxVNJ22Vh3tOdugjVSkz5OcwViuS7Yd3ABJ/K9u6tiLmPt+3XX46pjSAK+Km+8ma+Na5YKe9LxETSlxqVBZE0u1YFVcx3U2mo0ehf0ctUYwoeQkrFW3vq4adaescwzRtPNsSFW08jk0x4gH9RKlkQBlFrXZPQ1s= Received: from DU2PR04CA0348.eurprd04.prod.outlook.com (2603:10a6:10:2b4::9) by PR3PR08MB5788.eurprd08.prod.outlook.com (2603:10a6:102:8b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.23; Tue, 9 Jan 2024 13:26:51 +0000 Received: from DB5PEPF00014B9E.eurprd02.prod.outlook.com (2603:10a6:10:2b4:cafe::e3) by DU2PR04CA0348.outlook.office365.com (2603:10a6:10:2b4::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.23 via Frontend Transport; Tue, 9 Jan 2024 13:26:51 +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 DB5PEPF00014B9E.mail.protection.outlook.com (10.167.8.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.14 via Frontend Transport; Tue, 9 Jan 2024 13:26:51 +0000 Received: ("Tessian outbound 9f74e12f0f2b:v239"); Tue, 09 Jan 2024 13:26:50 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: ce30a9e49ef79bff X-CR-MTA-TID: 64aa7808 Received: from d1629aaa5549.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 965B8ACD-F3F4-4EF6-A2E3-9B603767C406.1; Tue, 09 Jan 2024 13:26:44 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id d1629aaa5549.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 09 Jan 2024 13:26:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ieripOI7CV/gpTkQmGAaCtlK3ZC9rr7uB482jKXHStUZduSTb0w05cL5CDor6YMbKAzg8QaMF8ayo7s2IPAeZCRjrUlGIwRrDAQ3eOWls6E7uwm90wUsb0UYpiA4DKgkR9DpbkJ9/O9EUyap1R/XHlBl2qwsp+lyZPBH5hj64Np2jk/DFKheek4YBXhzRPFRNAw9jgYnHMEG0DWdt2mbqUPxW9XEtku/vlWV5ZpvpP5Y7tDr5Hr4C32D7F626duUYMxv0lrjFY68J0KnxW5CmN7e4EubrYoZRF9NwdxGgmtuz8ANLETRkrLK92+6fpIm3W644Ubn2nNplxMZrfPxhA== 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=wSMuT0Ztqzz5ohUfQoUxqxnGaFwjhA+G3WNyJyPiifU=; b=gp0rbpws+WYKd6il6G5BDaZeN+IL5WRIgBiBy1AbaVffWSBlL8uCtOaM2emCAFnU7h04w3V9XpuZddytpxuZQbXXTbJP6I6PXdsq2iy/MZh4Sw6YXvwG1GvwPJ0aRjn699ajTxfxSqRi2vN8KjJYL9AbJTxdUW2MhfPvCOTv6ipFsrBj2nivzKmpF+w74zn3VsdgRwuD+RMptiPEov4YKUMOcM5JNkjalmNz2KQwAA9lxULqgZb0KhvyrJEwFVz5YcwiRa7gTvcX0+B1PoBnlLqFWv468cciXHvYBQiIM3D1EEFHDVTcC42WU44buNZ8GSy7pjcVradIdFItq/j88w== 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=wSMuT0Ztqzz5ohUfQoUxqxnGaFwjhA+G3WNyJyPiifU=; b=xMhaGDtk910/GxVNJ22Vh3tOdugjVSkz5OcwViuS7Yd3ABJ/K9u6tiLmPt+3XX46pjSAK+Km+8ma+Na5YKe9LxETSlxqVBZE0u1YFVcx3U2mo0ehf0ctUYwoeQkrFW3vq4adaescwzRtPNsSFW08jk0x4gH9RKlkQBlFrXZPQ1s= Received: from VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) by DU0PR08MB8090.eurprd08.prod.outlook.com (2603:10a6:10:3e9::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.21; Tue, 9 Jan 2024 13:26:38 +0000 Received: from VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::9679:2ab0:99c6:54a3]) by VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::9679:2ab0:99c6:54a3%6]) with mapi id 15.20.7159.020; Tue, 9 Jan 2024 13:26:37 +0000 From: Tamar Christina To: Richard Biener CC: "gcc-patches@gcc.gnu.org" , nd , "jlaw@ventanamicro.com" Subject: RE: [PATCH]middle-end: Fix dominators updates when peeling with multiple exits [PR113144] Thread-Topic: [PATCH]middle-end: Fix dominators updates when peeling with multiple exits [PR113144] Thread-Index: AQHaOmV5Le9fU51rpEKy6ygkeBVv0rDP5QwAgAGJDUCAAAr9gIAADnoQ Date: Tue, 9 Jan 2024 13:26:37 +0000 Message-ID: References: <8pn44s40-pqs9-s99r-6qs4-1p9432692p7q@fhfr.qr> In-Reply-To: <8pn44s40-pqs9-s99r-6qs4-1p9432692p7q@fhfr.qr> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; x-ms-traffictypediagnostic: VI1PR08MB5325:EE_|DU0PR08MB8090:EE_|DB5PEPF00014B9E:EE_|PR3PR08MB5788:EE_ X-MS-Office365-Filtering-Correlation-Id: ce16bf76-77b8-412f-30fb-08dc1116a38b 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: ZK5li2lwgsziMhKW6JtKTtgv4fhhbRW0WX6mZfUzomEP43VtINxoVImPXQ1iFWsdkuIc0Jbo4HlXTOSJkm8yypKOZI4C3xPOFiuIT8CJaMse1qScs7DvVPNT21egnJhkt4gnOZHXmlLf6cnKQlPckcAWVnwLceiG51e7LEhvZEIBDIumxRqs2c8mIvK616Bn6qGqGmi45U8g/5C6xdSKP1p41TiJYdq1jNf/MChgdTGAcwlVZwwmf4tREVfreNblh+B5RRx8IWs5ybbSiJf7vW7jXl3uapkHWM0U5dHOMlEZCDK++JpR2TA7g/mq5IjJwFqWKRRFmNNWkJfUqKXI3/dQOdtLLUS3n0E/0GPYmG/i9gFI5POyeJdgt4hRR+MBqfTsAqWIzAnviqWPCIIZGLJrS1esRkRs7QQvM21ey4zxYmGKTAoZBFw+tBMN2sDKCQOhQ118jG6acV2FXri2mt/W2rPnruC1r3VE5sweEwXG/JRttm2DXHFmmj7S3NAR4qtPj9XTAAF6v3Lam+VsFbQw1Kjz+Gt1O3vpIhhVg7t67b27CbIJi8YEq8990sNGLi8LxSOpJswQLwfRJC68UHLajWIsaZFO8HbgKtABhNlbpiGJaC3M5cXI9/wVqiglgI+YLgKOZNomCu/2kHKDpQ== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR08MB5325.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(396003)(346002)(366004)(136003)(39860400002)(230922051799003)(186009)(64100799003)(451199024)(1800799012)(66556008)(66476007)(76116006)(52536014)(66446008)(8936002)(8676002)(66946007)(478600001)(26005)(83380400001)(64756008)(71200400001)(966005)(55016003)(2906002)(6916009)(15650500001)(5660300002)(38070700009)(122000001)(38100700002)(41300700001)(4326008)(7696005)(316002)(86362001)(6506007)(9686003)(84970400001)(54906003)(33656002)(53546011);DIR:OUT;SFP:1101; Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB8090 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: DB5PEPF00014B9E.eurprd02.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: eabff8a1-fd07-4479-0d48-08dc11169b9f X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ouaJleTsKVg1IihXQIp5WoqHFKilzZ193F8iSFiAOL1u8e4qrrp+pXcYbEm+9pukgms9CikeWlPxMbNZ7M9usABFGy3qFahrOju5NPeTOqSdvlpdThw2QgyN2cRlp8hA/tled7fUObhHDymAUHnGi003cMR/LGJI1pDAg5gO97UgEVvRoOpM6FJzUxB4NOdq0ArvScy4X/PqAdzlNICHhxwbx+b1xUChukFU3BE3lYSY6gQAEL3LLbWZnjB4BkkXaaUCF1/G4bm8YevE7enl3iVo5OKkU0g/NoSTFapBUi7MHYrU5ttkgrl3MBxcEHCisJ7FHa9dd6qg4RPDa7i+URGACoCM63z6MWnRoDJ4n3r0pg/43mjHjYNO4d1gOg8+bGFKnQ8qB7/wpdoSfQHr4JAGRCnWV56PuVXU3jThtJsc+eBUzX4wv6qWL/qV0ZhCGfUE8VfFBEuucOHOPYNicshQHJICA+pgJd0MEMfocHnNtJsK0InolBSrBPyKf7xKDTnEHbsZqaZN0e5/BsiRuc8X6Tm6xlNu/+JPkxcYwz/7/p02raa4shVP3YGqFwj7t9+5IA73WY9ChJdDmsLPwcZyubD/abg2dY+oWylx1eOGn2D7P57q5pzftNr4LNl/MtUjgjMg1g4+USGuglkRyfNMEC+NR8Wir9b/Gxa1w5Y+4Plwrd+RFFwMrJRqLoaNwAOnWx67q0PGGglAHJgWtuuhcXT9zGMVdtF5FIQ4mHogeZdcUKQFF1h92IW74tV+lsk/sDfuXPp24nYje1RWUg== 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)(136003)(346002)(376002)(39860400002)(396003)(230922051799003)(451199024)(82310400011)(186009)(64100799003)(1800799012)(40470700004)(46966006)(36840700001)(55016003)(40480700001)(84970400001)(40460700003)(83380400001)(70206006)(41300700001)(70586007)(356005)(81166007)(33656002)(86362001)(82740400003)(36860700001)(8676002)(47076005)(336012)(26005)(107886003)(53546011)(6506007)(9686003)(7696005)(966005)(15650500001)(2906002)(54906003)(316002)(478600001)(8936002)(4326008)(5660300002)(52536014)(6862004);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2024 13:26:51.0528 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ce16bf76-77b8-412f-30fb-08dc1116a38b 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: DB5PEPF00014B9E.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR08MB5788 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FORGED_SPF_HELO,GIT_PATCH_0,KAM_DMARC_NONE,KAM_SHORT,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: > -----Original Message----- > From: Richard Biener > Sent: Tuesday, January 9, 2024 12:26 PM > To: Tamar Christina > Cc: gcc-patches@gcc.gnu.org; nd ; jlaw@ventanamicro.com > Subject: RE: [PATCH]middle-end: Fix dominators updates when peeling with > multiple exits [PR113144] >=20 > On Tue, 9 Jan 2024, Tamar Christina wrote: >=20 > > > This makes it quadratic in the number of vectorized early exit loops > > > in a function. The vectorizer CFG manipulation operates in a local > > > enough bubble that programmatic updating of dominators should be > > > possible (after all we manage to produce correct SSA form!), the > > > proposed change gets us too far off to a point where re-computating > > > dominance info is likely cheaper (but no, we shouldn't do this either= ). > > > > > > Can you instead give manual updating a try again? I think > > > versioning should produce up-to-date dominator info, it's only > > > when you redirect branches during peeling that you'd need > > > adjustments - but IIRC we're never introducing new merges? > > > > > > IIRC we can't wipe dominators during transform since we query them > > > during code generation. We possibly could code generate all > > > CFG manipulations of all vectorized loops, recompute all dominators > > > and then do code generation of all vectorized loops. > > > > > > But then we're doing a loop transform and the exits will ultimatively > > > end up in the same place, so the CFG and dominator update is bound to > > > where the original exits went to. > > > > Yeah that's a fair point, the issue is specifically with at_exit. So h= ow about: > > > > When we peel at_exit we are moving the new loop at the exit of the prev= ious > > loop. This means that the blocks outside the loop dat the previous loo= p used to > > dominate are no longer being dominated by it. >=20 > Hmm, indeed. Note this does make the dominator update O(function-size) > and when vectorizing multiple loops in a function this becomes > quadratic. That's quite unfortunate so I wonder if we can delay the > update to the parts we do not need up-to-date dominators during > vectorization (of course it gets fragile with having only partly > correct dominators). Fair, I created https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113290 and w= ill tackle it when I add SLP support in GCC 15. I think the problem is, and the reason we do early dominator correction and validation is because the same function is used by loop distribution. But you're right that during vectorization we perform dominators update twi= ce now. So Maybe we should have a parameter to indicate whether dominators should be updated? Thanks, Tamar >=20 > > The new dominators however are hard to predict since if the loop has mu= ltiple > > exits and all the exits are an "early" one then we always execute the s= calar > > loop. In this case the scalar loop can completely dominate the new loo= p. > > > > If we later have skip_vector then there's an additional skip edge added= that > > might change the dominators. > > > > The previous patch would force an update of all blocks reachable from t= he new > > exits. This one updates *only* blocks that we know the scalar exits do= minated. > > > > For the examples this reduces the blocks to update from 18 to 3. > > > > Bootstrapped Regtested on aarch64-none-linux-gnu, x86_64-pc-linux-gnu > > and no issues normally and with --enable-checking=3Drelease --enable-lt= o > > --with-build-config=3Dbootstrap-O3 --enable-checking=3Dyes,rtl,extra. > > > > Ok for master? >=20 > See below. >=20 > > Thanks, > > Tamar > > > > gcc/ChangeLog: > > > > PR tree-optimization/113144 > > PR tree-optimization/113145 > > * tree-vect-loop-manip.cc (slpeel_tree_duplicate_loop_to_edge_cfg): > > Update all BB that the original exits dominated. > > > > gcc/testsuite/ChangeLog: > > > > PR tree-optimization/113144 > > PR tree-optimization/113145 > > * gcc.dg/vect/vect-early-break_94-pr113144.c: New test. > > > > --- inline copy of patch --- > > > > diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_94-pr113144.c > b/gcc/testsuite/gcc.dg/vect/vect-early-break_94-pr113144.c > > new file mode 100644 > > index > 0000000000000000000000000000000000000000..903fe7be6621e81db6f294 > 41e4309fa213d027c5 > > --- /dev/null > > +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_94-pr113144.c > > @@ -0,0 +1,41 @@ > > +/* { dg-do compile } */ > > +/* { dg-add-options vect_early_break } */ > > +/* { dg-require-effective-target vect_early_break } */ > > +/* { dg-require-effective-target vect_int } */ > > + > > +/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */ > > + > > +long tar_atol256_max, tar_atol256_size, tar_atosl_min; > > +char tar_atol256_s; > > +void __errno_location(); > > + > > + > > +inline static long tar_atol256(long min) { > > + char c; > > + int sign; > > + c =3D tar_atol256_s; > > + sign =3D c; > > + while (tar_atol256_size) { > > + if (c !=3D sign) > > + return sign ? min : tar_atol256_max; > > + c =3D tar_atol256_size--; > > + } > > + if ((c & 128) !=3D (sign & 128)) > > + return sign ? min : tar_atol256_max; > > + return 0; > > +} > > + > > +inline static long tar_atol(long min) { > > + return tar_atol256(min); > > +} > > + > > +long tar_atosl() { > > + long n =3D tar_atol(-1); > > + if (tar_atosl_min) { > > + __errno_location(); > > + return 0; > > + } > > + if (n > 0) > > + return 0; > > + return n; > > +} > > diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc > > index > 76d4979c0b3b374dcaacf6825a95a8714114a63b..9bacaa182a3919cae1cb99dfc > 5ae4923e1f93376 100644 > > --- a/gcc/tree-vect-loop-manip.cc > > +++ b/gcc/tree-vect-loop-manip.cc > > @@ -1719,8 +1719,6 @@ slpeel_tree_duplicate_loop_to_edge_cfg (class loo= p > *loop, edge loop_exit, > > /* Now link the alternative exits. */ > > if (multiple_exits_p) > > { > > - set_immediate_dominator (CDI_DOMINATORS, new_preheader, > > - main_loop_exit_block); > > for (auto gsi_from =3D gsi_start_phis (loop->header), > > gsi_to =3D gsi_start_phis (new_preheader); > > !gsi_end_p (gsi_from) && !gsi_end_p (gsi_to); > > @@ -1776,7 +1774,14 @@ slpeel_tree_duplicate_loop_to_edge_cfg (class lo= op > *loop, edge loop_exit, > > { > > update_loop =3D new_loop; > > for (edge e : get_loop_exit_edges (loop)) > > - doms.safe_push (e->dest); > > + { > > + /* Basic blocks that the old loop dominated are now dominated b= y > > + the new loop and so we have to update those. */ > > + for (auto bb : get_all_dominated_blocks (CDI_DOMINATORS, e->src= )) > > + if (!flow_bb_inside_loop_p (loop, bb)) > > + doms.safe_push (bb); > > + doms.safe_push (e->dest); > > + } >=20 > I think you'll get duplicate blocks that way. Maybe simplify this > all by instead doing >=20 > auto doms =3D get_all_dominated_blocks (CDI_DOMINATORS, loop->h= eader); > for (unsigned i =3D 0; i < doms.length (); ++i) > if (flow_bb_inside_loop_p (loop, doms[i])) > doms.unordered_remove (i); >=20 > ? >=20 > OK with that change, but really we should see to avoid this > quadraticness :/ It's probably not too bad right now given we have > quite some restrictions on vectorizing loops with multiple exits, > but I suggest you try an artificial testcase with the "same" > loop repeated N times to see whether dominance compute creeps up > in the profile. >=20 > Richard.