From patchwork Wed Dec 6 04:03:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamar Christina X-Patchwork-Id: 1872428 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=Yz0ZT9oe; 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=Yz0ZT9oe; 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 4SlP054YGVz23mf for ; Wed, 6 Dec 2023 15:03:31 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2C82A385C306 for ; Wed, 6 Dec 2023 04:03:29 +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-db5eur02on2050.outbound.protection.outlook.com [40.107.249.50]) by sourceware.org (Postfix) with ESMTPS id B5859385840B for ; Wed, 6 Dec 2023 04:03:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B5859385840B 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 B5859385840B Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.249.50 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1701835398; cv=pass; b=FYtyHon2E40qDtF4N4JWX4gfftWxV9fk3EwYhk10dKxPXmR4+gbsuAiDtrneLG0pc+mogeWI+ZKUg28YfPsD5/Njw096HW0Lnq0KlPg2w0y/cMW8WbHdegkXps/tfGMaApq7uK6ze5LfvgeZzmLOtUNJDYnsGfATIUkwDAikPuw= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1701835398; c=relaxed/simple; bh=c4IlpeOsIyhOS5t6vKRjclBovremTOil94WEoQ2AFY4=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:Message-ID: MIME-Version; b=buoW6UeZJHgYQGSniX7ikTlijE1J3RZsa5zHZoOhpha8PSE+P3S0PPb2nE1eND4btTuf0w60b2agcJDReAY2q3o+90tSjArxzDvAoulS7ym9hksxhFh0n0CYbleVJvLh9ir3NnYhwAmNrZiDVAQdRZ+vK5KqMRCaRW/OGMRU6DM= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=LARIUPXtXpclMH2RH2A1aXvpVc/8Ydro7yTPSPN09aRyGOvKYjBc4tc7MxS7EQ59FeZuJSGTqlL/K7fn3vbPhcKLlGVGQt9NNCfziI8YbhYPCm/aURtQrJXQO4l+QC9c/4erQmlYvLKPr6t/WuIprU7wkzfrsB5OzU6gND9NB0bZIUB2fZorZ8ElSWae1/Q7sJpMXY3IvBVQcAnRZkt1A5ac6L3UqZ1tURewNEF1u+goFzKT4HxptyVYoFddG/CnAXZGjE7rfCIziYS4ljFmIdxTEk89OjiBxj4a2eoexEY49ZmTUdFL7fxY7gv9yDmS3DtD4tKU4jBZH6mXmLk/jQ== 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=8Edo5IfG8+zt/n2TGxjDLBF14D3c0g9iLKsgUqlm34E=; b=Vtx06k+/7cx0qtJ3dVea7VL2FQZ/A1MCg0iTFWYMe0TDl6yD4QyijqG2ProEyywwY7+cDggNq4CPgUbQAKmRDafvi1CkbShAR8V3zN86Nv0C07qpXHacgJljdkD8R9ZvlF+g1RgIF6dHKuiFLaX0mR5wLro0akWY2hz8spYczdZYQ1gPqOzpLpsBVZos+09jRN7clsYcPFxhe0038G9VZ1TMS96eaEBjnsuw9rLhJAyb+2aC8O/Ppy60OjtFDrmrja1sA6vGdio5a2AKqjGdzeFDwzWfRS6aV4oYnWD0eSN/i42+PWBhJtvnunGcvjSrDfR8OCVGonT5Ai/lQSFCCA== 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=8Edo5IfG8+zt/n2TGxjDLBF14D3c0g9iLKsgUqlm34E=; b=Yz0ZT9oexUJw0fa0V+3mapGPWCOwfhHWUIbJeuyJ7+GJZwo3sHyd4SGQnfS6xPnSJPYQRoTRopR6wV9YWID0Gfv8koE5RhL/B9rUtcPuVVra+Y7RNGdlp1G18kw5CDgxMeAdLmencZTy7wyXxPxVKVLRV7cY43mMcqPZsv742Cs= Received: from AM4PR07CA0022.eurprd07.prod.outlook.com (2603:10a6:205:1::35) by PA4PR08MB7644.eurprd08.prod.outlook.com (2603:10a6:102:262::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.34; Wed, 6 Dec 2023 04:03:13 +0000 Received: from AMS0EPF00000199.eurprd05.prod.outlook.com (2603:10a6:205:1:cafe::dd) by AM4PR07CA0022.outlook.office365.com (2603:10a6:205:1::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.24 via Frontend Transport; Wed, 6 Dec 2023 04:03:13 +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 AMS0EPF00000199.mail.protection.outlook.com (10.167.16.245) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.20 via Frontend Transport; Wed, 6 Dec 2023 04:03:13 +0000 Received: ("Tessian outbound 8289ea11ec17:v228"); Wed, 06 Dec 2023 04:03:13 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 78d2ab06de97f5c7 X-CR-MTA-TID: 64aa7808 Received: from f9e45d3fc7a8.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id BB06CEF3-4C58-4FEB-80F4-B1AA1625DEFE.1; Wed, 06 Dec 2023 04:03:06 +0000 Received: from EUR01-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id f9e45d3fc7a8.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 06 Dec 2023 04:03:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SryekKCMFI2iCXwuhEwi6x0V12qkgr0Mpgki5gyUK+ZF4LFlw1OT/oPPkF61lD3ukSvew6Xok1JrFaxZ3slgA/f6CNA/y02lhnXIxE4W0IODdjixUmHe6snT2JWQOLRzrnHcJkzRTKRN4xXVcXPZHw/rPOcGdHxlUI7zzJ/sBIg0Ym0UBiORdkHTbYbwMaFH/Pf+BoU6v6QSLbIaKvGT/s7jWcHPn1ni8XwUWBhZtmi7oC0wRXDo8L537hWCpe+nmm/ftM61XQf9QTRNWkFeq7DjT0f/XevSfgAO0p1usTTmfm6rRzlDYhrvi3WetBD26HSLVqAjsqihYKR+q3T+1g== 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=8Edo5IfG8+zt/n2TGxjDLBF14D3c0g9iLKsgUqlm34E=; b=cIUX9fmkPFH63ePEpPqSk2LPmXr/Le6wJyRcjXkMGVQJryYb9O7gK7R+A8ONAfKJmYDEYjBuU8sR96WxcVX1NSQCqg9UsEnqvv4ZZ/hsNxeyXji9NqPwI70RldVaIQejGoj1RGxrtZ+TcUyt8K+5SPkdW9AAb8BMtRrV6zB3foltccF6d8ugEyO7zxkyhrcsI5Wau4oGU8oaTC4CA/dd/Iqu5h75J0wRhyeq0w9tAeY93ps5XmhhekR+eXQ59N4iAItXqGKLUtRAk/7TGHWiGY/OEipGOR5jCbtwjrDOfqsNtFu4ilLcVSr75bdJBWonhZG/xA5ps0t///ZVJqY6gQ== 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=8Edo5IfG8+zt/n2TGxjDLBF14D3c0g9iLKsgUqlm34E=; b=Yz0ZT9oexUJw0fa0V+3mapGPWCOwfhHWUIbJeuyJ7+GJZwo3sHyd4SGQnfS6xPnSJPYQRoTRopR6wV9YWID0Gfv8koE5RhL/B9rUtcPuVVra+Y7RNGdlp1G18kw5CDgxMeAdLmencZTy7wyXxPxVKVLRV7cY43mMcqPZsv742Cs= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) by DU2PR08MB10263.eurprd08.prod.outlook.com (2603:10a6:10:491::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.34; Wed, 6 Dec 2023 04:03:02 +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.7046.034; Wed, 6 Dec 2023 04:03:02 +0000 Date: Wed, 6 Dec 2023 04:03:00 +0000 From: Tamar Christina To: gcc-patches@gcc.gnu.org Cc: nd@arm.com, rguenther@suse.de, jlaw@ventanamicro.com Subject: [PATCH]middle-end: correct loop bounds for early breaks and peeled vector loops Message-ID: Content-Disposition: inline X-ClientProxiedBy: LO4P123CA0387.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18f::14) To VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB5325:EE_|DU2PR08MB10263:EE_|AMS0EPF00000199:EE_|PA4PR08MB7644:EE_ X-MS-Office365-Filtering-Correlation-Id: 07374f62-d068-4ba4-3fe3-08dbf61044be 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: 2VQuhTt3zj3erkd0J6J/O3hgsd/cICCaYN1dbdYA0+lFbeBNRpJF/D/FFRNkWzkAjgiVu+sABsbaJeKPg5c9ix9xwPFblm7sV1Xs6UT+eWVZKKUF8otyae5EuqdeXiA2ifutDlMOCTmhih2mdIAORHAQ88+zVpy2nlf9pKZSI6jqr4ABTQhPhqfCHzBGSXAFC7geqk+7nDvYY8OXa4eg8AvcWPxGGJoIstO65tOsTKUZC8fw4pjju58msMwCJd9scpk/VYAE9wRRhAna2lDYW8Ecbv+uHERLyelAaZCq2nLb14VXREZeHN5FC+uevoGKDo7g8Xpb4drELnqLS6dOQwgAMYND9yCxNeEEjgs15+doggzUk6RTOzmsTHVaEfqbZ8I2mnXl9/XyhYggCbgWHIkGSpfBNx/kQdrzXihKnMk8Bd4fnmf5Y8rXjsVrUvlSlJjv7WlpHc4h5Rt7TG6q4DCII5Cevgyb9kuUgsc1DrBUmAKgHm0xVjFEBuPIKnpPjAJTm7j8DCDB/o1VEve358gVpvtS3JPe5TZy5J7Sp7digh2xAitFwC4//yFfyj1LQg+6tdEyZZpJ1eeQcsIsn0BuK3XoRETt/dX1w87ONriK2+iRet9vNqO6b/VOsPvHwq1Vf03jMYddxj/YkG+ckQ== 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)(396003)(366004)(136003)(39860400002)(346002)(376002)(230922051799003)(64100799003)(451199024)(1800799012)(186009)(44832011)(2906002)(5660300002)(235185007)(36756003)(86362001)(41300700001)(6506007)(478600001)(33964004)(6486002)(44144004)(6512007)(38100700002)(83380400001)(26005)(2616005)(4743002)(8676002)(4326008)(8936002)(6916009)(66946007)(66476007)(66556008)(316002)(4216001)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR08MB10263 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: AMS0EPF00000199.eurprd05.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 4dbcc1a5-909b-42e8-c423-08dbf6103e25 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 35p4gvOA9Ia4i0OpS+k47hwUwO40miR9mzwlBwkwkrUpR7TU0FOqN9ZwPIKsxA6qUjFAJ1dS1QVfhNXCAb5vgEGpZmknaGvLEsjqtbM8Bj2g+phNmJ/FSY6KqxMxYSSBR4SruixSl5a6BG8pJ3v6pq7BCBGtj1nQB/6OG4L5RY5oihWXXJnVBTSupsQUGNn1O8JIazJSi+AgkUBoNRkMEWl9sgjhqP0Mx8XGLMM8GDEAgFc4QZ6c8k0nQQ/pJHWxxHtp6hxa7G8Qef76XuiF8rpStDscHE2bwaepvnO4atb8+V1MzU4BSHJ2AlhKMqkccLIC9ybkcdLwyY9BQ5G3tDxKI9qzL1pT7JbkCt2cqtR253hqoes9e2kGTybSRpFWrau4D0kOKIkmHVZkY1UUOsI0eSOGmo3CE2B3yRPiApHbUyFEEPptzhbuGFs8N59s5cPK3655pZU6I558oFmmpBjJUbkSHbYT6b29qVoMMtbfO63Z2Mlv59TuNw6C1aONGdO3/2CvI9uEE6s1Upj6uuxwUDBDwHrYqzVq69cc0wk9mvWxcUtHoviZumSBisLfgqnhWjC2/7WkotC2Qn71ck4L/+fbo8r5NaidnwIJbDQOZo4hOWaAT27rWGoYLpdq7TlD2WMo0fi3dhecDU9WQ73jV/AL/uTwJveTIfBfP+iLe1llfQ7drboQgKsO6RpvB4HwpnbmCsPNewC/+RXm9Y99YQ77N70WlLDomOWgfNVIftLijE5YKc5NwxztdVosXW3z9gqKCd14SPuv0aUQ76yUDfqoCvzasvVITlFkd+s= 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)(376002)(136003)(39860400002)(230922051799003)(82310400011)(451199024)(64100799003)(186009)(1800799012)(36840700001)(46966006)(40470700004)(4326008)(36756003)(41300700001)(5660300002)(235185007)(2906002)(40460700003)(44832011)(86362001)(82740400003)(83380400001)(356005)(47076005)(81166007)(6506007)(478600001)(44144004)(33964004)(6486002)(336012)(26005)(107886003)(2616005)(4743002)(6512007)(40480700001)(70586007)(6916009)(36860700001)(8676002)(8936002)(316002)(70206006)(4216001)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2023 04:03:13.5816 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 07374f62-d068-4ba4-3fe3-08dbf61044be 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: AMS0EPF00000199.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB7644 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 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 Hi All, While waiting for reviews I've continued to run more test. In this case this was one found running 32-bit systems. While we calculate the right latch count for the epilog, the vectorizer overrides SCEV and so unrolling goes wrong. This updates the bounds for the case where we've peeled a vector iteration. Testcase in early break testsuite adjusted to test for this and I'll merge this commit in the main one. Bootstrapped Regtested on aarch64-none-linux-gnu and no issues. Ok for master? Thanks, Tamar gcc/ChangeLog: * tree-vect-loop-manip.cc (vect_do_peeling): Adjust bounds. --- inline copy of patch -- diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc index 4edde4443ecd98775972f39b3fe839255db12b04..7d48502e2e46240553509dfa6d75fcab7fea36d3 100644 --- diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc index 4edde4443ecd98775972f39b3fe839255db12b04..7d48502e2e46240553509dfa6d75fcab7fea36d3 100644 --- a/gcc/tree-vect-loop-manip.cc +++ b/gcc/tree-vect-loop-manip.cc @@ -3457,6 +3457,12 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1, if (bound_scalar.is_constant (&bound)) { gcc_assert (bound != 0); + /* Adjust the upper bound by the extra peeled vector iteration if we + are an epilogue of an peeled vect loop and not VLA. For VLA the + loop bounds are unknown. */ + if (LOOP_VINFO_EARLY_BREAKS_VECT_PEELED (loop_vinfo) + && vf.is_constant ()) + bound += vf.to_constant (); /* -1 to convert loop iterations to latch iterations. */ record_niter_bound (epilog, bound - 1, false, true); scale_loop_profile (epilog, profile_probability::always (), --- a/gcc/tree-vect-loop-manip.cc +++ b/gcc/tree-vect-loop-manip.cc @@ -3457,6 +3457,12 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1, if (bound_scalar.is_constant (&bound)) { gcc_assert (bound != 0); + /* Adjust the upper bound by the extra peeled vector iteration if we + are an epilogue of an peeled vect loop and not VLA. For VLA the + loop bounds are unknown. */ + if (LOOP_VINFO_EARLY_BREAKS_VECT_PEELED (loop_vinfo) + && vf.is_constant ()) + bound += vf.to_constant (); /* -1 to convert loop iterations to latch iterations. */ record_niter_bound (epilog, bound - 1, false, true); scale_loop_profile (epilog, profile_probability::always (),