From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2066.outbound.protection.outlook.com [40.107.20.66]) by sourceware.org (Postfix) with ESMTPS id AAA953857714 for ; Tue, 14 Nov 2023 08:07:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AAA953857714 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 AAA953857714 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.20.66 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1699949261; cv=pass; b=kC4kcacq3+5Xhe4ju4+U/fV8emTBuQVgFto0vXlGpE8FSbkRJ3nXyLJm2In1Szui6XrvTwzjq6VR+oprMJAucl8wdT1/TUxTUdnFBe7kg5PNBZzNzCJYqEH5xuGx/WnS0DPMzUnb3bEcmN+dWuOvQgpmppqVlLTjYMkYI/ywosk= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1699949261; c=relaxed/simple; bh=GsIzg1jp8bU9rO3GE7wj9ARLXfFNFR0ie9xfbomswqw=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=WWnvbK68+47zkWw17qdRAzk+JwabSLwcSQHj0QbeCIyK9PHu+2Ub3EzSgjSNzAMpQ3xil1wIa5IQs9RM9KNfzkySEPyQSKleH2M0exUaj+RHPV3dWuJ9253hVj7vF9aYdQ6O0y7/+S+aTqbkupBdjxp3sKbqgsMrkOPbeeLdwwQ= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=AkHqY1dqWEmFK8iHO0RcDoHUe9Q4xoV7c3IjjYhr/y+6PdOoNhMRauHHAq00e1/NokguR+ctA+ZKDJE/rBd9ost+FVtfklhhduDevp+VscMoJKDRLhtXzIr7/YnSzdnEVnT8ctMKjU9Kmal0GdC7o8YrzSY1aNQVuRHbb/t5V1em9Jo7dym43yRCZ/CIUMh9uNuL1oezkggHL0OzcTQKEE6YISdsitCEFq31i35BVMaczhTGMLwL04Vb+Dm5wCh0ITlEe6ghtQGay9Kaz8nqz62Jd/ocxNKUfai+h3lcbpD5ztdcvVJgobc2YeRybWlDS9ppRnHVqJ4isPew+COODQ== 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=Wdt983Y0zCH6bG4AYLmgx+rQXJgT1uMzljkhzEzNgkE=; b=aETAZaRFF44syobJQ1MKE1fQpJGCJCptNIJCBQRnN+hgdITa92Tju11QukKGm0BGjAc1rXn5AExVGKHGPiQRVLxVxVn10E1qPW2T1ad/cne70sSQdYNbwMpSuZEC+alKCe++tAmyxR+4GI53oSxb1A8ttY8UGnx172Yxdmm45GrfHdoS7wHr185yYJKg98g+ydRDkwYenD+1LppEbK7+1q7WIpETShiE8wTrgsPGvPCali3Vy1vXEgrLydfarsARSb/ldqPKbzrAg2oaTCppg0+x7R2ClhznheTG0TWcOcKH22SmeOEXog8jKfD/DBRj7gDfKZFwct4dQGfWYpFSPA== 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=Wdt983Y0zCH6bG4AYLmgx+rQXJgT1uMzljkhzEzNgkE=; b=KxG9953jzVTKX/21gsWRDQ1qUnjydCDz7QGW0mr39rbaYL7F0sLKL35bR70ZeNzqRHMdn6hVr+b7jZ4WzOnPWKLzneisoesFRDNln+grYLLBWa/AzoWGnMv3IFkzSossVbo6FPNMbcNcG/58hjKwtMw3JIs+nSp/qpXJq2jFgRY= Received: from AM0PR10CA0044.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:150::24) by DU0PR08MB8162.eurprd08.prod.outlook.com (2603:10a6:10:3ed::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.29; Tue, 14 Nov 2023 08:07:34 +0000 Received: from AMS0EPF000001A2.eurprd05.prod.outlook.com (2603:10a6:20b:150:cafe::e6) by AM0PR10CA0044.outlook.office365.com (2603:10a6:20b:150::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.31 via Frontend Transport; Tue, 14 Nov 2023 08:07:34 +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 AMS0EPF000001A2.mail.protection.outlook.com (10.167.16.235) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.13 via Frontend Transport; Tue, 14 Nov 2023 08:07:34 +0000 Received: ("Tessian outbound e243565b0037:v228"); Tue, 14 Nov 2023 08:07:34 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 8a351b6aca80a9de X-CR-MTA-TID: 64aa7808 Received: from d7a2742693be.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 905A2399-D88E-422F-A492-9FEF4DF24145.1; Tue, 14 Nov 2023 08:07:27 +0000 Received: from EUR03-DBA-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id d7a2742693be.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 14 Nov 2023 08:07:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NeQnRVOiE/F6uyljk2a2ciCxsBI2IrJB0uacxBVclHN3iv4xbzx9aL7pgBKZarQfNInxaY5Ycp+eQN9w3SpJZzpVtnRHtEfpT8mGTWNJ4tF1lTGYqTo0fAxXTJoJsioTeBqqPSCY9nhl490sGwYIAypgb1Ke7M+6ybNWQZN5znM9bvxwudHzBu9HPrJzkwB1PF0EFGuyNOs3yifzrdBkFhz/PIs17c3qj2AuyfM/1Mm0JSGo5/OlcFEjH6pb8tQqL/RzfNwUsEH+8qBVpLKVqczJhIa+bZ2CjGOnV8ciFoNCDoYLG/3ss4L7J+Ci2VDtdgUtzicC63ntcUKwO1xtaw== 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=Wdt983Y0zCH6bG4AYLmgx+rQXJgT1uMzljkhzEzNgkE=; b=f0OsVmnpPPpBYiKbRWJcuEJgWDb66A7f9ps0yVjVqc1GEK09ZX3nEGdgtAVScP1s4FUvv2Of08pWlr51z01KILax2PO05j0MtGqh8tB2B6tuGUwv6gd0iHIkx4TnVGAR6tzB+hUTP0TzjyBvp1YMRWz97V+A7aLmny5nKB/A6UOsa0w5YgMWNoE2t94lZ0FQRnujrcSSFAff1jOs5s26uyKCjA6X+lqn3bszlafuBca4+u5gEZ5jKsZB8d94U7vA38m5ZHNgiJ3yCEOTg2ceUrxvixCnIgvPTxTdqlPzyVpTIBDsYuD3seSGLd/izidziyIvctCiMkopmhwBm8WtaQ== 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=Wdt983Y0zCH6bG4AYLmgx+rQXJgT1uMzljkhzEzNgkE=; b=KxG9953jzVTKX/21gsWRDQ1qUnjydCDz7QGW0mr39rbaYL7F0sLKL35bR70ZeNzqRHMdn6hVr+b7jZ4WzOnPWKLzneisoesFRDNln+grYLLBWa/AzoWGnMv3IFkzSossVbo6FPNMbcNcG/58hjKwtMw3JIs+nSp/qpXJq2jFgRY= Received: from VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) by DB9PR08MB7628.eurprd08.prod.outlook.com (2603:10a6:10:30c::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.18; Tue, 14 Nov 2023 08:07:24 +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.6977.029; Tue, 14 Nov 2023 08:07:23 +0000 From: Tamar Christina To: Richard Biener CC: "gcc-patches@gcc.gnu.org" , nd , "jlaw@ventanamicro.com" Subject: RE: [PATCH 5/21]middle-end: update vectorizer's control update to support picking an exit other than loop latch Thread-Topic: [PATCH 5/21]middle-end: update vectorizer's control update to support picking an exit other than loop latch Thread-Index: AQHaEIQ+Iau5X0e+Z0WdQvM9MBiwy7Bu9kUAgAnCFxCAAMalgIAAAgFA Date: Tue, 14 Nov 2023 08:07:23 +0000 Message-ID: References: In-Reply-To: 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_|DB9PR08MB7628:EE_|AMS0EPF000001A2:EE_|DU0PR08MB8162:EE_ X-MS-Office365-Filtering-Correlation-Id: 5d55c07f-80c2-4f74-e790-08dbe4e8c22a 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: b2g8hga20PX/UAvjS6yJfpwjUaRkhy/5p3nX/M90hodhIllbEj0y5n4h+OvaMiesWTtczBPkQmtcvmBKuenxm/gYZXDNXXTEiOXkATNrc2fF/ll20oO5ACK1PhyMWhWRNLqXWzI3jAXibAzz5KXgqfMOrkpX1AAhPnzqXrH/YLybptkKg2mTHe9rCmxnug3gmavFj30ArbvdHTuKmVnyczhN6483TzGfZC5hT1f3t4G+jMm7ZmPQjHyXX9mjJ4oFjk0MlQK62UGV50VGnO16kotHw5WKNx/InORF6Nxj37uERC5KJET88aUaXguh6Uo3aUJXtYCj9il7/Y88oyzTbk5oPN+MkuW3c+DPfehv/f/ZNm5DunJzpMqCfPvhRbdypLYx4Mz4LXeMYgd2aHVgMKV+J6ABR5TZkLnBOLrmfA1wueXmHvt+MrjCWspy9ScR4phPAYHj0aR5ZI1E7lK6IwW6O7S4vKxDpuYDffo7k+ss/8BHIY0qmGJTCQ0SCivldIfURlFw5bw2k9pyd9KFbhYApo7q40nSyUbDkiTI+d3rZISA7cPWDorgJtUKErcmrKs402PzSVTcgfMhFCn1bVOJYYMLttgcqTP1X+cLhv8= 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)(136003)(39860400002)(396003)(366004)(346002)(376002)(230922051799003)(451199024)(1800799009)(64100799003)(186009)(122000001)(316002)(52536014)(66556008)(38100700002)(8936002)(8676002)(4326008)(54906003)(33656002)(66476007)(66946007)(7696005)(26005)(76116006)(66446008)(6506007)(966005)(83380400001)(64756008)(53546011)(6916009)(86362001)(71200400001)(9686003)(41300700001)(5660300002)(55016003)(2906002)(38070700009)(478600001)(15650500001)(66899024);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: DB9PR08MB7628 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: AMS0EPF000001A2.eurprd05.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 21fc468c-9d1b-480f-23ac-08dbe4e8bbd6 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zixNq9Ujd/Q9KXzYj4eqFizNOZMXVD5IOZJIOD+f4LHsQ6O7ZDgRDz+NgaHNMa4l42x5+9bPDsdo3HW9Wfs15HPebPvQzGzpSoaWbt2CeE1fFQLBtz8UMYKKPlDPpuzySmWNKGjzdzk33oixOurWrw1fDAllEWUgDSEq907wXHI1X6lViEYtm01Ii3pwJPVcovRUhSgR2nXC7fYoZO+9shgQOVQVdvp4uDg9EelUX7KHhbGfN/to1F2AY2iwBmv+n1aGnrS2KzCUrzFfJFfBVnM/hN9Zvtg5YK9Bb5OObysMO1gE447QhW1weDNvzTcE8uNeaQWr975oMU0+PjX3hR/ygAtLdvbVx3l7WdGIqPk2GPZnMzoFfGDVBMNpFRh2GRpGoO6jHipGnkzKr00R9GgbiaiJSfTUT3vFik81FbuouUvDOw7ZXO4X1bF7znxhkcA4ceU5Ww015hIW392BM43Y4S1an0TuQn7aDohh2gq20qbv5p2xYmlL9gn6F/q7G/NsM4YI0pYUnzYimTmJAYw36aiD32X7Z+dj6rLNOr2wxVbFRzVCZ+4tD9FzkMDB7gzkj8VD6hxa8b2Rh/JgNlrnTwkULUv1b6oBX14mpUEJooqW/LGyvxRbn+GFD0IN117p/suuQmBaGTd7R+hP3O40WL58kexJ3kuWzcAqXjQi7XSsFyzK9OhN3BFvwMyR9u1kXaE7w6QDF0tt/3Vrfl6A9C8ZZQhlEkLX5TzWLe0= 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)(39860400002)(396003)(136003)(346002)(376002)(230922051799003)(451199024)(1800799009)(64100799003)(82310400011)(186009)(36840700001)(46966006)(40470700004)(40460700003)(70586007)(4326008)(36860700001)(6862004)(8676002)(8936002)(81166007)(356005)(82740400003)(52536014)(70206006)(53546011)(6506007)(54906003)(478600001)(336012)(7696005)(966005)(83380400001)(26005)(9686003)(316002)(107886003)(86362001)(2906002)(33656002)(47076005)(15650500001)(5660300002)(41300700001)(55016003)(40480700001)(66899024);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2023 08:07:34.3569 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5d55c07f-80c2-4f74-e790-08dbe4e8c22a 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: AMS0EPF000001A2.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB8162 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,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, November 14, 2023 7:56 AM > To: Tamar Christina > Cc: gcc-patches@gcc.gnu.org; nd ; jlaw@ventanamicro.com > Subject: RE: [PATCH 5/21]middle-end: update vectorizer's control update t= o > support picking an exit other than loop latch >=20 > On Mon, 13 Nov 2023, Tamar Christina wrote: >=20 > > > -----Original Message----- > > > From: Richard Biener > > > Sent: Tuesday, November 7, 2023 3:04 PM > > > To: Tamar Christina > > > Cc: gcc-patches@gcc.gnu.org; nd ; > jlaw@ventanamicro.com > > > Subject: Re: [PATCH 5/21]middle-end: update vectorizer's control > > > update to support picking an exit other than loop latch > > > > > > On Mon, 6 Nov 2023, Tamar Christina wrote: > > > > > > > Hi All, > > > > > > > > As requested, the vectorizer is now free to pick it's own exit > > > > which can be different than what the loop CFG infrastucture uses. > > > > The vectorizer makes use of this to vectorize loops that it previou= sly could > not. > > > > > > > > But this means that loop control must be materialized in the block > > > > that needs it less we corrupt the SSA chain. This makes it so we > > > > use the vectorizer's main IV block instead of the loop infra. > > > > > > > > Bootstrapped Regtested on aarch64-none-linux-gnu and no issues. > > > > > > > > Ok for master? > > > > > > > > Thanks, > > > > Tamar > > > > > > > > gcc/ChangeLog: > > > > > > > > * tree-ssa-loop-manip.cc (standard_iv_increment_position): > > > Conditionally > > > > take dest BB. > > > > * tree-ssa-loop-manip.h (standard_iv_increment_position): Likewise= . > > > > * tree-vect-loop-manip.cc (vect_set_loop_controls_directly): Use i= t. > > > > (vect_set_loop_condition_partial_vectors_avx512): Likewise. > > > > (vect_set_loop_condition_normal): Likewise. > > > > > > > > --- inline copy of patch -- > > > > diff --git a/gcc/tree-ssa-loop-manip.h b/gcc/tree-ssa-loop-manip.h > > > > index > > > > > > > > bda09f51d5619420331c513a9906831c779fd2b4..5938588c8882d842b00 > > > 301423df1 > > > > 11cbe7bf7ba8 100644 > > > > --- a/gcc/tree-ssa-loop-manip.h > > > > +++ b/gcc/tree-ssa-loop-manip.h > > > > @@ -38,7 +38,8 @@ extern basic_block split_loop_exit_edge (edge, > > > > bool =3D false); extern basic_block ip_end_pos (class loop *); > > > > extern basic_block ip_normal_pos (class loop *); extern void > > > > standard_iv_increment_position (class loop *, > > > > - gimple_stmt_iterator *, bool *); > > > > + gimple_stmt_iterator *, bool *, > > > > + basic_block =3D NULL); > > > > extern bool > > > > gimple_duplicate_loop_body_to_header_edge (class loop *, edge, > > > > unsigned > > > int, > > > > sbitmap, edge, vec *, int); diff > > > --git > > > > a/gcc/tree-ssa-loop-manip.cc b/gcc/tree-ssa-loop-manip.cc index > > > > > > > > e7436915e01297e7af2a3bcf1afd01e014de6f32..bdc7a3d74a788f450ca5d > > > de6c294 > > > > 92ce4d4e4550 100644 > > > > --- a/gcc/tree-ssa-loop-manip.cc > > > > +++ b/gcc/tree-ssa-loop-manip.cc > > > > @@ -792,14 +792,19 @@ ip_normal_pos (class loop *loop) > > > > > > > > /* Stores the standard position for induction variable increment i= n LOOP > > > > (just before the exit condition if it is available and latch bl= ock is empty, > > > > - end of the latch block otherwise) to BSI. INSERT_AFTER is set = to true if > > > > - the increment should be inserted after *BSI. */ > > > > + end of the latch block otherwise) to BSI. If DEST_BB is specif= ied then > that > > > > + basic block is used as the destination instead of the loop latc= h source > > > > + block. INSERT_AFTER is set to true if the increment should be > > > > + inserted > > > after > > > > + *BSI. */ > > > > > > > > void > > > > standard_iv_increment_position (class loop *loop, > > > > gimple_stmt_iterator > > > *bsi, > > > > - bool *insert_after) > > > > + bool *insert_after, basic_block dest_bb) > > > > { > > > > - basic_block bb =3D ip_normal_pos (loop), latch =3D ip_end_pos > > > > (loop); > > > > + basic_block bb =3D dest_bb; > > > > + if (!bb) > > > > + bb =3D ip_normal_pos (loop); > > > > + basic_block latch =3D ip_end_pos (loop); > > > > > > I don't think that's a good API extension. Given that we don't > > > support an early exit after the main IV exit doesn't this code > > > already work fine as-is? It chooses the last exit. The position is > > > also not semantically relevant, we just try to keep the latch empty h= ere > (that is, it's a bit of a "bad" API). > > > > > > So, do you really need this change? > > > > Yes I do, If you look at these kinds of loops > > https://gist.github.com/Mistuke/66f14fe5c1be32b91ce149bd9b8bb35f > > > > You'll see that the main exit, i.e. the one attached to the latch block= is the > early break. > > Because SCEV can't analyze it picks the main exit to be the one in BB4. > > > > This means that the loop control must be placed in BB4. If we place > > ivtmp_10 =3D ivtmp_9 - 1 In BB 3 then that's broken SSA. If we use `iv= tmp_9` > in BB4 then we'll have an off by one issue. >=20 > OK, but then I think the fix is to not use standard_iv_increment_position= (it's a > weird API anyway). Instead insert before the main exit condition. I figured as much, Almost done respinning it with the vectorizer's own simp= ler copy. Should be out today with the rest. >=20 > Btw, I assumed this order of main / early exit cannot happen. But I didn= 't re- > review the main exit identification code yet. >=20 It can happen because we allowed vec_init_loop_exit_info to pick the last analyzable exit. In cases like these it happens because the final exit has= no Information from SCEV. It then picks the last exit it could analyze which b= y default is an early exit. It's very tricky to deal with and have just finished cleaning up the IV upd= ate code to make it easier to follow... but it does seem to add about 970 more vectorized cases (most of which are execution tests). Regards, Tamar > Richard. >=20 > > You could have reached the end of the valid range for the loop when > > you re-enter BB4, since loads are still allowed you'll then read out of= bounds > before checking that you exit. > > > > This is also annoyingly hard to get correct, which Is what took me a > > long time. Such loops mean You need to restart the scalar loop at i_7 = if you > take the main exit. > > > > Regards, > > Tamar > > > > > > > > Maybe we're really using standard_iv_increment_position wrong here, > > > the result is supposed to _only_ feed the PHI latch argument. > > > Richard. > > > > > > > gimple *last =3D last_nondebug_stmt (latch); > > > > > > > > if (!bb > > > > diff --git a/gcc/tree-vect-loop-manip.cc > > > > b/gcc/tree-vect-loop-manip.cc index > > > > > > > > 6fbb5b80986fd657814b48eb009b52b094f331e6..3d59119787d6afdc5a64 > > > 65a547d1 > > > > ea2d3d940373 100644 > > > > --- a/gcc/tree-vect-loop-manip.cc > > > > +++ b/gcc/tree-vect-loop-manip.cc > > > > @@ -531,7 +531,8 @@ vect_set_loop_controls_directly (class loop > > > > *loop, > > > loop_vec_info loop_vinfo, > > > > tree index_before_incr, index_after_incr; > > > > gimple_stmt_iterator incr_gsi; > > > > bool insert_after; > > > > - standard_iv_increment_position (loop, &incr_gsi, > > > > &insert_after); > > > > + edge exit_e =3D LOOP_VINFO_IV_EXIT (loop_vinfo); > > > > + standard_iv_increment_position (loop, &incr_gsi, &insert_after, > > > > + exit_e->src); > > > > if (LOOP_VINFO_USING_DECREMENTING_IV_P (loop_vinfo)) > > > > { > > > > /* Create an IV that counts down from niters_total and > > > > whose step @@ -1017,7 +1018,8 @@ > > > vect_set_loop_condition_partial_vectors_avx512 (class loop *loop, > > > > tree index_before_incr, index_after_incr; > > > > gimple_stmt_iterator incr_gsi; > > > > bool insert_after; > > > > - standard_iv_increment_position (loop, &incr_gsi, > > > > &insert_after); > > > > + standard_iv_increment_position (loop, &incr_gsi, &insert_after, > > > > + exit_edge->src); > > > > create_iv (niters_adj, MINUS_EXPR, iv_step, NULL_TREE, loop, > > > > &incr_gsi, insert_after, &index_before_incr, > > > > &index_after_incr); > > > > @@ -1185,7 +1187,7 @@ > > > > vect_set_loop_condition_partial_vectors_avx512 > > > (class loop *loop, > > > > loop handles exactly VF scalars per iteration. */ > > > > > > > > static gcond * > > > > -vect_set_loop_condition_normal (loop_vec_info /* loop_vinfo */, > > > > edge exit_edge, > > > > +vect_set_loop_condition_normal (loop_vec_info loop_vinfo, edge > > > > +exit_edge, > > > > class loop *loop, tree niters, tree step, > > > > tree final_iv, bool niters_maybe_zero, > > > > gimple_stmt_iterator loop_cond_gsi) @@ - > > > 1278,7 +1280,8 @@ > > > > vect_set_loop_condition_normal (loop_vec_info /* loop_vinfo */, > > > > edge > > > exit_edge, > > > > } > > > > } > > > > > > > > - standard_iv_increment_position (loop, &incr_gsi, > > > > &insert_after); > > > > + standard_iv_increment_position (loop, &incr_gsi, &insert_after, > > > > + exit_edge->src); > > > > create_iv (init, PLUS_EXPR, step, NULL_TREE, loop, > > > > &incr_gsi, insert_after, &indx_before_incr, &indx_aft= er_incr); > > > > indx_after_incr =3D force_gimple_operand_gsi (&loop_cond_gsi, > > > > indx_after_incr, > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > Richard Biener > > > SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 > > > Nuernberg, Germany; > > > GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG > > > Nuernberg) > > >=20 > -- > Richard Biener > SUSE Software Solutions Germany GmbH, > Frankenstrasse 146, 90461 Nuernberg, Germany; > GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG > Nuernberg)