From patchwork Tue Jan 23 15:40:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamar Christina X-Patchwork-Id: 191015 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp420169dyi; Tue, 23 Jan 2024 07:41:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IE3I3onuWqM0HggoG77NJyJEi5lgOUK/zqG+mQxX4xZt/0tf+IryJUOe5qO8hyJrxVFf1cA X-Received: by 2002:ac8:5a86:0:b0:42a:3cff:dbe8 with SMTP id c6-20020ac85a86000000b0042a3cffdbe8mr1340553qtc.19.1706024494741; Tue, 23 Jan 2024 07:41:34 -0800 (PST) ARC-Seal: i=4; a=rsa-sha256; t=1706024494; cv=pass; d=google.com; s=arc-20160816; b=UsiWQ2C6TgFCGDQklOoZeIGf4CwGVbVbDR7k+wuXi+Y4oUhj0jVk6oCpXkd18pAdLs O35tIDfqUQV72iOCn9Nm60Y5cuB3nbGhP1gVt4OZaKaUCW2Yvev8gpE0kQ032G5mh3IN zPoNiD4GRRy3R4tgahuLpaNJBf8I0hyOiTnWty3W3DTzKHNRRT7JPcw6IOnf1q8H2NDn JIkfr1Grx2pTNB3PUCgCto6vvfEMxiNkGzVcjAKxktbZzR7jeDQA+DkKARiyUGvwCl1e cRPm7TbgEiTfSSYvxgyvqCRLZPQD74O/UY/1vxft27cPuj0QjrT2w8Ifqwl3t/S0UFDL 3/KQ== ARC-Message-Signature: i=4; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:original-authentication-results :nodisclaimer:mime-version:content-disposition:message-id:subject:cc :to:from:date:authentication-results-original:dkim-signature :dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=jjgpjSkSrxNEqMdWE7XwXEsFLhwJD6l3puHvxuZFSaE=; fh=6lLuKcPp5JwcfhLsQ40FQN1vJS1KxlKbf2GiViQwbCM=; b=niXpEv4mQuDB7hXHMZJhwA+ZJiXus+4cF/q/zcmZ13NfLsPwgVzduhg3NLnS+n+3Bp 4qKOh/hNaRubHanOIrBDTu/9suw8x8cT8QHsD1iwOWclJ5Bof/JutIrtbybFu1hoI6Oo Q7krOrUy4IMIfaXaMSGw117Fr59k6L6kzo3MlMQN/qu2ShEpJzD0n9GTpTeAkNkRxEtI lNU+sNz0ItiUwz89wrgR3d/9QyEiLltWjBzKPe5Puvs1gG8f/1/PDBYkmdr313ofk6CP LurcWucaXaL+JgWDbNbQLwhWRv6GTOIEFXCFdztUzzkzDnnjqwpMP8j3NrjfqWH/fcol DZ7g== ARC-Authentication-Results: i=4; mx.google.com; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=nz0i3wEQ; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=nz0i3wEQ; arc=pass (i=3); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id b1-20020a05620a0f8100b00783264580b0si7910980qkn.57.2024.01.23.07.41.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 07:41:34 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=nz0i3wEQ; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=nz0i3wEQ; arc=pass (i=3); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6B70C3858C36 for ; Tue, 23 Jan 2024 15:41:34 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2080.outbound.protection.outlook.com [40.107.6.80]) by sourceware.org (Postfix) with ESMTPS id B7A473858CDA for ; Tue, 23 Jan 2024 15:40:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B7A473858CDA 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 B7A473858CDA Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.6.80 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1706024448; cv=pass; b=PRqFd7qP9AMsaZpEOUrLggVMPX19b7Uh/gkIlQ0OnmPAW6PIGnStoBrWdhScTPLZyPVNXV5ZYlWMlCcs+Llwzxf0H1eth1tqWuzUIdQV6FvkWb4Oo5z300gVGxZESCjasKBif8CfeuA12WEaggIIWXu7K1LX155DhuZHpql8CVU= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1706024448; c=relaxed/simple; bh=LbiU7cUG506+WU2pmwjOQwij7Lbs0S08sMrITgwMgxY=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:Message-ID: MIME-Version; b=BU+WpvoHmQCv/LTBH8u9I135k++aXBKTSC5pcyZDMbl4bVLWXBjM5k6EOiKJPLiTVHThjp6VfudpyX+ocrZBFPceT5I9bXOyGeYM+PNs+MXcnJk3pmgNVGB8XD+kAvkHjQXe3m65Kk76OPHEDIa5X7xP8lGkvEVotr6ylcLN0X4= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=FTJHcHuF7ZaO6mQsFtLhzF0DORZJZRbNX4lpW4pjFswg4YgHW7YkhpSp73vnVziZxu41OHVCUP4ivtAHIuxmCkDosS4+WOtvyNqmjJQHiiNGxSQNxjWQCUozz30YkcmgHIRNwCWpWEDksGMb7uVq2qYjcVaGc4AL9Yrg944oQWtvSAC+BZq8xkEKFti+IdxffDQbdNXF41yLnZ4TzOKLEdqIBldKGW6sEYKDzMoNzn1cPT+JLgtfFOK5TKtwHwGsT+McYGg0XGmGnH1PNvr1dIdvUT1cjFKov2CbZ43g8TuXwWbiO0hf78EKHe/h0wIUXj8tkNR9a9RX9Ns8+JjBRw== 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=jjgpjSkSrxNEqMdWE7XwXEsFLhwJD6l3puHvxuZFSaE=; b=f38H2/QZph7Y0xslmE+wB86SltrMlWflBVjeCYwklB/AP0jVmtN1AqUzdNfz1urkF5pohW4RBuKApwDOxwn315hLkRj09nGfeRqtZKFOQaLWVQk6ZsilKcFIGlbjnM48g10SXJkDhb75DPXPeWejSnO44A4Zqq5VpzWULxpDThj1FiKLcxJX6BZuO61KDgGO3cTErIbTdl8e3mu32yRlnmc5OVux4ebjjYO/s7OgcmTk1B7R3Ztnx59AuWTt2u0N4wTUikk3S5r2jWbSqrtsIAgREq5YotVWFwyUkS/jM35DydZMCYqAXeX3szC/+ZBRDBUc5HYvkq1I1fhycP2Yrg== 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=jjgpjSkSrxNEqMdWE7XwXEsFLhwJD6l3puHvxuZFSaE=; b=nz0i3wEQAqTdCKhOkAVllnOEzWsixKBEjRfSqEbXkK/2X3TNPz+QqvA3rt/geI6NSlsfNyn6r63bXASyVUYEzt+jNwp8udhNvTck2KsPCFL/Dfj2U1lgHXm/Ea6rBZYGX+JmxGn8w1cpO78kthrxZa+nhwGQa8QjeNQ0lI1ffq4= Received: from AM0PR10CA0081.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::34) by VE1PR08MB5630.eurprd08.prod.outlook.com (2603:10a6:800:1ae::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.37; Tue, 23 Jan 2024 15:40:41 +0000 Received: from AM3PEPF0000A797.eurprd04.prod.outlook.com (2603:10a6:208:15:cafe::a2) by AM0PR10CA0081.outlook.office365.com (2603:10a6:208:15::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.37 via Frontend Transport; Tue, 23 Jan 2024 15:40:41 +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 AM3PEPF0000A797.mail.protection.outlook.com (10.167.16.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.16 via Frontend Transport; Tue, 23 Jan 2024 15:40:41 +0000 Received: ("Tessian outbound c87008563c51:v228"); Tue, 23 Jan 2024 15:40:41 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: a5b7f229d24466bb X-CR-MTA-TID: 64aa7808 Received: from ed83802c16a1.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 7AFFD7DF-937E-42BD-A997-2EF6A930AADB.1; Tue, 23 Jan 2024 15:40:35 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id ed83802c16a1.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 23 Jan 2024 15:40:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mau+DwfRXGa3wuQjPrE781Z7WUjQyerSwKfwsoVUMKmVuh5Li+wBabbR+qROG0jMRxrAtXUFSyIr6NrPaF3oGFCxf2gAOwkg+2oHtlJ4UM/kZX3fD9KUz7fmgunbfxNfdJ2m7EOEuBqupmYC/YVNCgdccdJLwELk6QhKIrZr0fR8bLDrckPrOrWs2G+8EyV+vRE842wPabw8KrhRa0G/gUyntM5uK6twFCeTwM5hTuj4Fkf4XxWCYls9KJNhaHro/tfYt9Uvrwj7CU7nQjTt4SIfyoTsFLyR6bjq9ZTTBI2JgsVLgKfCR6+r8Hwm9taZDP0lzFM5hlIRoHIOBW+GzA== 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=jjgpjSkSrxNEqMdWE7XwXEsFLhwJD6l3puHvxuZFSaE=; b=dQiOxL6hO/zMwPEWvTwElYb41fbdZzUHEVn21iibFULCbOoUV+MMW8WagauRI3mC4sEEhU0/PEk530APrHeR7oqrDd/3DomtigPR8xPfo8ZLVvHqQZjNrg2/wgMtWjeHElbk/hRa0jfZXkl1qTp3yQY+ibjMdq2HngSDj425O3c4uDkCAIlxOenFPyIgupzpYH86FIkOy/V9VvESSq45BVqTT5ni/eF6S9cdJnedDyONmCvwXVjz13fH6eHKEzA//F9JQmCVEth09/EmEexCe+qgDGWzWkSq4IXkRLrh+AvrHKYXY2G4V6UKbgDtdbkbBmTTjq9sk9tQV3yMtBdrsA== 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=jjgpjSkSrxNEqMdWE7XwXEsFLhwJD6l3puHvxuZFSaE=; b=nz0i3wEQAqTdCKhOkAVllnOEzWsixKBEjRfSqEbXkK/2X3TNPz+QqvA3rt/geI6NSlsfNyn6r63bXASyVUYEzt+jNwp8udhNvTck2KsPCFL/Dfj2U1lgHXm/Ea6rBZYGX+JmxGn8w1cpO78kthrxZa+nhwGQa8QjeNQ0lI1ffq4= 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 PA6PR08MB10662.eurprd08.prod.outlook.com (2603:10a6:102:3ca::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.29; Tue, 23 Jan 2024 15:40:32 +0000 Received: from VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::810c:8495:3f0a:ef8]) by VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::810c:8495:3f0a:ef8%7]) with mapi id 15.20.7202.035; Tue, 23 Jan 2024 15:40:32 +0000 Date: Tue, 23 Jan 2024 15:40:30 +0000 From: Tamar Christina To: gcc-patches@gcc.gnu.org Cc: nd@arm.com, rguenther@suse.de, jlaw@ventanamicro.com Subject: [PATCH]middle-end: fix epilog reductions when vector iters peeled [PR113364] Message-ID: Content-Disposition: inline X-ClientProxiedBy: LO2P265CA0456.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:e::36) To VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB5325:EE_|PA6PR08MB10662:EE_|AM3PEPF0000A797:EE_|VE1PR08MB5630:EE_ X-MS-Office365-Filtering-Correlation-Id: c2112409-1882-445f-7ec1-08dc1c29a7ed 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: ZoTlNc/rS/ebK7XaXJl3Inai8Yw4r7nMt+Pub5GmYU+ouLE66SLdsHxtW6AmPfPk//o2ChqSF4LfvcP29pXpjKVZPBU7NNwKjwK49UJ1lxRTp5vGX9U3bVn2CeABI9v5iBnZ7odKVNbP+8acoH+oNHpw26xI6kjoj3ovrwy7GVNe4yAXybJOkQhM5rdpdu6aq0TkZb3jUjKGnrhAqEno0PqgNL5L7GrBzq0Ch529PQbtaTUA6CYZvSP8QKofYRiiCsGiRHZJ1ItZUJTHnsLj6X9Z2QX+3VnOgOuZWP0+tKl5jnHBqJ5CQ7KdN2OFITbQX9uPyvdlpxxgiH7UapB2tZrhqacF+5TjLnMYR559PMLhkLLbf0HDMMgRMCgBnf+ITfc8A7141Tsn2+wxXYhpUosEg8uQswof4t8mS6aEWWYBaf7ZeTa4jCW6FUXZYm2jmmTFawFLZ9eqRc/pvabG+8089ZO+TEivn+JScv2J5HYVNcvxP7BdNb39/m9Zy00m3+wcoesBY89axhG8u00f+lmhX1BbD7HyQ8mPIZz9o6gRwI8DEUSdFjvGzxOwcWn9XgS7h4RlC5d6tcaX9cJ9qTXjFti1nP/KNWhB00Mt0peUyGwHJ4r+1VSM1oyRajih 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)(39860400002)(366004)(136003)(346002)(396003)(376002)(230922051799003)(186009)(451199024)(1800799012)(64100799003)(84970400001)(4743002)(86362001)(36756003)(41300700001)(6512007)(8936002)(83380400001)(316002)(5660300002)(6916009)(8676002)(26005)(2616005)(4326008)(6506007)(66556008)(44144004)(38100700002)(478600001)(6486002)(33964004)(66476007)(235185007)(2906002)(66946007)(44832011)(4216001)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA6PR08MB10662 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: AM3PEPF0000A797.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 66c74b48-c5c4-4d0d-5cc3-08dc1c29a261 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RyZWlm6v7ouhSNJwThq/FB+Sm5TYK1U1mhKw6YfnUPV+vNGOpWYfonb1oAbUcKshBAqsC5cHG8BgobBE111I4mDE03sRk6fDeu/OlXAyxtZJTNhS7Xp8dw6g13G5oBQTlXg5kkf5VrYWEe5BwbhaxJa1Nvl4h1bdlawPPyVj5ZhdAvSECI5gjwHdeJcG7HmlzHKNxpY16cjJNUhG4f5gPhdAsXuS+s4Tm+QDP8/DLbxQZxYSnh0GWQ6JVF6Wgz7HKdjmjJwLV0WmNktfwOgK/FDi04FA4lE8ICHw6d4J7/AbM3/Yxh1LOH8al0anfSI0+spSeQEuXE/4mUhMg08yVkf95CPdcFoUuOpmq1/2Jl4xvTBU5FCeuNFF1eW/oXkQ/+z9662mbOYa+m8ZcNehzq8cJESFxpyB129NdXEIO5pALV+57IBIxhgDgVMrSj7pcgdxZ4gXpG9pLcEpRIuk77T9D/Cq5b3yDqVBdnCjV/p/C0HhZlZxdIJt63d39G/mBNu1/QpEROPuo2HYAEc3kVEQ14eOsSxzRnG84xv3WwZ9vHtMgr1iWKIgm6JsMUC3N4mn4gDPcet1Nb1I+kJGcCnA8ZXaO9CkT8e8cvNqj+63EE9yD/QtBj6EiV3UcW8+XGrZGw6ebI/xpQL+Zx9beNlpvDQK88OKmpjK/UXcmEaorpSfiEvSRwhLQoJkfySxb8fgyyXuyEL4Nzd0taIKYJ+A2tWZup+c5mhth1NYZZlx7cjFerILewO16KSkP39K2DhokSwW6jjx6UMOsRUjoA== 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)(396003)(346002)(136003)(39850400004)(230922051799003)(64100799003)(1800799012)(186009)(451199024)(82310400011)(36840700001)(40470700004)(46966006)(40460700003)(40480700001)(84970400001)(86362001)(44144004)(6486002)(478600001)(36756003)(336012)(4743002)(356005)(82740400003)(81166007)(2616005)(47076005)(83380400001)(26005)(107886003)(33964004)(36860700001)(6506007)(235185007)(2906002)(8676002)(4326008)(6916009)(6512007)(5660300002)(44832011)(8936002)(316002)(41300700001)(70586007)(70206006)(4216001)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2024 15:40:41.5895 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c2112409-1882-445f-7ec1-08dc1c29a7ed 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: AM3PEPF0000A797.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5630 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, KAM_LOTSOFHASH, 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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788896340523687126 X-GMAIL-MSGID: 1788896340523687126 Hi All, This fixes a bug where vect_create_epilog_for_reduction does not handle the case where all exits are early exits. In this case we should do like induction handling code does and not have a main exit. Bootstrapped Regtested on x86_64-pc-linux-gnu with --enable-checking=release --enable-lto --with-arch=native --with-build-config=bootstrap-O3 --enable-checking=yes,rtl,extra. This shows that some new miscompiles are happening (stage3 is likely miscompiled) but that's unrelated to this patch and I'll look at it next. Ok for master? Thanks, Tamar gcc/ChangeLog: PR tree-optimization/113364 * tree-vect-loop.cc (vect_create_epilog_for_reduction): If all exits all early exits then we must reduce from the first offset for all of them. gcc/testsuite/ChangeLog: PR tree-optimization/113364 * gcc.dg/vect/vect-early-break_107-pr113364.c: New test. --- inline copy of patch -- diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_107-pr113364.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_107-pr113364.c new file mode 100644 index 0000000000000000000000000000000000000000..f489265dbfe5eb8fe302dcc34901abaf6e6d5c14 --- diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_107-pr113364.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_107-pr113364.c new file mode 100644 index 0000000000000000000000000000000000000000..f489265dbfe5eb8fe302dcc34901abaf6e6d5c14 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_107-pr113364.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-add-options vect_early_break } */ +/* { dg-require-effective-target vect_early_break } */ +/* { dg-require-effective-target vect_int } */ +/* { dg-additional-options "-w" } */ + +typedef const unsigned char *It; +It DecodeSLEB128(It begin, It end, int *v) { + int value = 0; + unsigned shift = 0; + unsigned char byte; + do + { + if (begin == end) + return begin; + byte = *(begin++); + int slice = byte & 0x7f; + value |= slice << shift; + } while (byte >= 128); + *v = value; + return begin; +} diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index fe631252dc2258e8ea42179b4ba068a480be9e38..4da1421c8f09746ef4b293573e4f861b642349e1 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -5982,7 +5982,8 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo, loop-closed PHI of the inner loop which we remember as def for the reduction PHI generation. */ bool double_reduc = false; - bool main_exit_p = LOOP_VINFO_IV_EXIT (loop_vinfo) == loop_exit; + bool main_exit_p = LOOP_VINFO_IV_EXIT (loop_vinfo) == loop_exit + && !LOOP_VINFO_EARLY_BREAKS_VECT_PEELED (loop_vinfo); stmt_vec_info rdef_info = stmt_info; if (STMT_VINFO_DEF_TYPE (stmt_info) == vect_double_reduction_def) { --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_107-pr113364.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-add-options vect_early_break } */ +/* { dg-require-effective-target vect_early_break } */ +/* { dg-require-effective-target vect_int } */ +/* { dg-additional-options "-w" } */ + +typedef const unsigned char *It; +It DecodeSLEB128(It begin, It end, int *v) { + int value = 0; + unsigned shift = 0; + unsigned char byte; + do + { + if (begin == end) + return begin; + byte = *(begin++); + int slice = byte & 0x7f; + value |= slice << shift; + } while (byte >= 128); + *v = value; + return begin; +} diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index fe631252dc2258e8ea42179b4ba068a480be9e38..4da1421c8f09746ef4b293573e4f861b642349e1 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -5982,7 +5982,8 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo, loop-closed PHI of the inner loop which we remember as def for the reduction PHI generation. */ bool double_reduc = false; - bool main_exit_p = LOOP_VINFO_IV_EXIT (loop_vinfo) == loop_exit; + bool main_exit_p = LOOP_VINFO_IV_EXIT (loop_vinfo) == loop_exit + && !LOOP_VINFO_EARLY_BREAKS_VECT_PEELED (loop_vinfo); stmt_vec_info rdef_info = stmt_info; if (STMT_VINFO_DEF_TYPE (stmt_info) == vect_double_reduction_def) {