From patchwork Mon Nov 6 07:39:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamar Christina X-Patchwork-Id: 161852 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp2496149vqu; Sun, 5 Nov 2023 23:40:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IHt9QLHdn+jHG5XA3Qx8qFvd3NSw5dlPYpmRPADYpiK+tqkmtwaV/shFLAW3HQ/+XsfXAgv X-Received: by 2002:a05:6214:768:b0:66d:3e3e:5bae with SMTP id f8-20020a056214076800b0066d3e3e5baemr37478789qvz.30.1699256427860; Sun, 05 Nov 2023 23:40:27 -0800 (PST) ARC-Seal: i=4; a=rsa-sha256; t=1699256427; cv=pass; d=google.com; s=arc-20160816; b=GpWBzpfoZQOpgb35g7hNMNavX2TB+eiizD5UD0w5ouf8BPvNSJ9KuxB/OQjRhx8sYD lK5hJBZdzvclgdKqqfA+xOBhyZqzJleO0Njl6K1YzxlBgW6IA/9GLIfWXp7aizedqwu+ hcqg+drhOVoTZpr39bqDGFHTWiiY4jAjrXv9IBPUdaLno0m2WR4JpBSREooTl2Hzy72/ x/SmZGp+kwslyOW3P20oPyz0Ta0g9umUNnILF/h+I1jP0RJgAJ3Q8rUo3j3s/uLOsEP+ NZvgpPYhIweMFJjiEyx9DU0Cj7jv+oZe6So7HwcVNXwBCI5tctI1I3q47km9d8yvs8XH gYhA== 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:in-reply-to:content-disposition :message-id:subject:cc:to:from:date:authentication-results-original :dkim-signature:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=QmhV/Z+ZW3RW//CesLUVi5C1oNwyGaWVUPwxZWHAEWw=; fh=6lLuKcPp5JwcfhLsQ40FQN1vJS1KxlKbf2GiViQwbCM=; b=yWVZxm+mkjtuQM+hYF27gCGn91k1OXa+SAcSwIVT97obGWhJXc9GLDQRBfUqY/ia+S 7O8t0bdX4WjzT5DvveEPYRfa3OmC3yyDVJw+86KszYU8FgyvenqVgZZYM7Y6BVGxdwyq 9qsaXVgj1c0a5v37m3G4fyj0EQ916rAVqGwmIttRrE6+IYf2al7wVmNMEcG1BSJjqMpm x+QEURiinpq2hutKzarII/oONxjLo5eJRDimwxUG2CH/E0AoG5loIhyMpdrAq24LG6ok gBtvfiysIHE9ovS70Nq43PCCvSTKm4d4Fbdjgj/MUDb9oTUbB3eiRtXM4Nz4nO6X8qDD J5WA== ARC-Authentication-Results: i=4; mx.google.com; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=edcrj7Mn; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=edcrj7Mn; 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 v14-20020ad448ce000000b0064f4d7d85c4si5268407qvx.354.2023.11.05.23.40.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Nov 2023 23:40:27 -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=edcrj7Mn; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=edcrj7Mn; 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 3A01638618CA for ; Mon, 6 Nov 2023 07:40:10 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2040.outbound.protection.outlook.com [40.107.20.40]) by sourceware.org (Postfix) with ESMTPS id 76E61385F02B for ; Mon, 6 Nov 2023 07:39:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 76E61385F02B 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 76E61385F02B Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.20.40 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1699256384; cv=pass; b=JzKlF0Lc3uqQ31wYdLbDjQHroXY60WBvwc5aVH2CluCKqSRpO4791Q6NWwTLQbuDKeA1sai2rcq0/H7ctNcS9nGspogXvUrbnF5ANy00Y/GfY9uaZIhgUVjWl+IFW0lcI/VtHkp84GgxEsnd+/TNsx6kTxLqYh6LR7ZTt1OeghY= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1699256384; c=relaxed/simple; bh=pR0h/80DUasAELwZGx69N8hUAtlUiQ2hwxI8a5Cvfu8=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:Message-ID: MIME-Version; b=ksVHqwT1nZWC2WjGSHG1d+xs3HIFwmJieLGUwJe6O6ugkTTw3gQLYKdNUbbdannKiDhnQsPmlWf1web5GPWYM/W8OlT1dj4xPYMeLWCM9FhhXh6dClqNvZUQKOo494144fc7FPt2cO1mrGL2qWqNAS56oz+YfCC692eUaULnk5I= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=GnCjpVdddO1gQFTabtAmhyJ4duUgCMS3ZKWToqFXhSjEl1HlPAeDWtxKvbgd2OV0/UPjybftvM8UzKIEZgAj1ynQcuUJW7HimmCMAz3rW4Opb8WgcBEQeVd2CXKtpy6qQdrAf46wWCi6SkfBnRf6fp4pq1uKZ8QvwDIFbQaCKK5biBkKXmebhe/ElisUd1XcS85hXTPlu/WxDk/TINDOvfWoZld9dcA7OzN4FXhOHLdqd2rrlMuitz/ZmEWkqUe359fW+iqysjOYUDjn/LMOX+U7iDK0artRPGhyz4rthGERwPs0o2LyU83O3b+553y8EIzpW1L7vh+HJIN1f9+ObQ== 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=QmhV/Z+ZW3RW//CesLUVi5C1oNwyGaWVUPwxZWHAEWw=; b=ggmzcYnmZZOU9iVkKi4AM1VoVI52c55wHsbnzIX5dbwWmxhQFqlgICFSDwoIl+p0mLnycXGx6MTHxEx77tCsPKrWziwmD3WAWdWaJd6SGzZDFBUwJBMy5E2Ayc2z/V2HOvKgO7Gkj3gPYYTbdVlQ+qYwTSMckZNxYVEY7bK9SRiKKp6EjIEhM/XeQJtLxc4Irz6mJ9KrEwRa828DZyQrVXK6hPNHlVx75My8PTflS6rTsV3vbKa0x7FRF2lcGONUDFa6QGSnTEHE0AXHv3sEGj/aWWLFBWUReVH66ueUS2yHA/hiAK06WupDJxb7lVBFLjLyDmyQD+dxMgLBzcLk4w== 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=QmhV/Z+ZW3RW//CesLUVi5C1oNwyGaWVUPwxZWHAEWw=; b=edcrj7Mn9XU2cP41855oqMuVS5VlmGWDt986Fuy0cxdb0vg3lxDApH8N8IslvJh9HTYPA0HMKooSIY817vwlWtE09ERdm/bNWGh26PI57HeGZkWFqIjeQWae3A86NZ/RmkgbtyVljex6Bdi95PT/XWPxkUByiQ4IfEs5Fidci50= Received: from AM0PR02CA0010.eurprd02.prod.outlook.com (2603:10a6:208:3e::23) by AM9PR08MB6276.eurprd08.prod.outlook.com (2603:10a6:20b:2d4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.25; Mon, 6 Nov 2023 07:39:37 +0000 Received: from AM4PEPF00027A63.eurprd04.prod.outlook.com (2603:10a6:208:3e:cafe::bd) by AM0PR02CA0010.outlook.office365.com (2603:10a6:208:3e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.28 via Frontend Transport; Mon, 6 Nov 2023 07:39:37 +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 AM4PEPF00027A63.mail.protection.outlook.com (10.167.16.73) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.16 via Frontend Transport; Mon, 6 Nov 2023 07:39:37 +0000 Received: ("Tessian outbound 7671e7ddc218:v228"); Mon, 06 Nov 2023 07:39:37 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 1cca2e519e476221 X-CR-MTA-TID: 64aa7808 Received: from 863f5fc1e358.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 0A4630F8-5CEC-4250-92EB-3B1A8CDF1578.1; Mon, 06 Nov 2023 07:39:30 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 863f5fc1e358.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 06 Nov 2023 07:39:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QGjRuXBJB0yskrwPSmUnbH5m41XpoRs/geGNmHvsOZkgYlY+iLzj4/KlSQbhxwU/l5xgFMUxXDuregDmKCW6yFmPa2jTYYcho3fPCs4YcKc474AmvUpB+fhrx6F4kpcinmBDLcvUNFF8kc8HA7vIa5wYv7JE0we7lAQebV7z0mzK2AkMtEEuUoxaHfHsk9AY9vqFcuQpYPd23jA+tSWJd0h3JjYEzFg3FxM4OebSoPtpKIavFGJE52e8NV69GLN8ELlKVKnHQAW70m8o7rFSYAvzKD9fFrwD37LIBotocTJ1dJUS4GOIQt68HBRjJpSFn33kzTnN5jfQc9CY2OPedw== 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=QmhV/Z+ZW3RW//CesLUVi5C1oNwyGaWVUPwxZWHAEWw=; b=MMqfP0PxNVEf96EZvU6NX3R+NMi3WUaCL4bAfxTAuxTYqa8s630dcHz9cHMueIMnxls6u+dnPX7KnnHrWr07lYoFZtuvRdiy+YWbByAFHhHrb2Fvbj7S+Yp6W4/UykQnhUMCmBHqy/4VYoGow1fB3O41OHWs2u4IfqW8ncGkeXaAEy3cfwE/C1X37iHMv8BVV8eLT5Zkp57jlXLfEGCCMap58AD3VvHQOTHl72yzFzyJWHjHqwdTII6NzAIgjVL7fVl58Az5Aue/cTxZAGFmVoVTsgmfHiPOYzH3YKnzkFaQRAOpc4rQXP2cuWnHzEr4n72CJME8p4HbJXuxLRMxNg== 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=QmhV/Z+ZW3RW//CesLUVi5C1oNwyGaWVUPwxZWHAEWw=; b=edcrj7Mn9XU2cP41855oqMuVS5VlmGWDt986Fuy0cxdb0vg3lxDApH8N8IslvJh9HTYPA0HMKooSIY817vwlWtE09ERdm/bNWGh26PI57HeGZkWFqIjeQWae3A86NZ/RmkgbtyVljex6Bdi95PT/XWPxkUByiQ4IfEs5Fidci50= 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 DBBPR08MB10676.eurprd08.prod.outlook.com (2603:10a6:10:530::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.28; Mon, 6 Nov 2023 07:39:27 +0000 Received: from VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::26aa:efdd:a74a:27d0]) by VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::26aa:efdd:a74a:27d0%5]) with mapi id 15.20.6954.028; Mon, 6 Nov 2023 07:39:27 +0000 Date: Mon, 6 Nov 2023 07:39:25 +0000 From: Tamar Christina To: gcc-patches@gcc.gnu.org Cc: nd@arm.com, rguenther@suse.de, jlaw@ventanamicro.com Subject: [PATCH 8/21]middle-end: update vectorizable_live_reduction with support for multiple exits and different exits Message-ID: Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: LO4P123CA0067.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:153::18) To VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB5325:EE_|DBBPR08MB10676:EE_|AM4PEPF00027A63:EE_|AM9PR08MB6276:EE_ X-MS-Office365-Filtering-Correlation-Id: 12a933cc-c869-4da0-5b39-08dbde9b875c 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: 3c4owLxI9rcgw68AqLUUh2oimhbrRWAU60uUGVVV2SufkbBe76l8BD4OEL6/3REcnil6ZTwTNIRQDiWlkBQl1UqaBs/IZW6qYqU55pCMfQk8VcViyVuOiyDWun1fiu9Df6Izjm4i/DhV8VmMKOuAGq3YUEGL2S05oHxYZPSe6dVfIpVni6k5okm/xHn9TIh3Aeh5jqoZdN0F+4vDItCyXGyivFNgT5OoEp8kAjr2xn0EZZ+tnpDZOxw8UIjMZDgfLQnC7YkNFZLdNTImxhYXgFmgfYzTM1KcTSr9D/yaAqS3fgGQzjD0dOzVH1urw+4Pze69xOD4XN9yuThMtrXR1Ons31nOm3IojNUS8Q2tTY2cKnc/dXCZZyKTki608wv7U7mGFsGMcQy+y5nnW6brTPY60sg1/fpy6LB6zFeYqfTXfIFUGPn1T53SpyzOs8JjXcoO5SUoDzMIY5ilwrDSUp2uYvYGA6XI1RJytRCY+7vOdZXcRT6uR7kWWrC7mwQuWPEz6jtbjuV2jrT6H5LKWRGJoLr+/pBRrcLLdNi7em/CwSgGSGEJqpRNdvbxwZNoUqi7vqIEOCfXlyZjozVnqGoGEfHSZFGbkzq1nMBb5n4/gqoC3MpddJaXU9LY55nF 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)(396003)(376002)(366004)(346002)(39860400002)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(6916009)(4326008)(8676002)(8936002)(41300700001)(36756003)(2906002)(235185007)(38100700002)(5660300002)(6486002)(66556008)(6512007)(316002)(66476007)(86362001)(44832011)(15650500001)(4743002)(66946007)(83380400001)(26005)(2616005)(6506007)(478600001)(33964004)(44144004)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB10676 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: AM4PEPF00027A63.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: a589e286-9e37-4e86-942a-08dbde9b8175 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Q2S4f+RwL1rNVldbO19YJgCaFXJGgQGnjFEDELX6lTljbSfhjKWmACYPC2Yo6aidvmwQhf1dpSsYGhPpxVLsukyPUYhVChYID5YgtZM26EFnhE4HbXzJBt419o4ttMk5tIkbzgOrM3OCHOj/vtMJXKGuVN8KkXaygKY3xeyZMgR1NWI931x7YrflBU3hM2Qnqcmufe7rWFesEFQXKFdxEoV/au9VSx1At3jzZvH06fku8PUNcB6vru4/DeyML/SaHJH9RJCIHpbBEoa6fiFyd5JIQa0ZSLYtG3RfMvwdmzJ8+l1wcN0Q3+Fm/ak6pZCMs1/Lnmx2Is0QvNQjDhl9L71nm6eb3ic6EKBPtYc+O8TUhH0NG6DM9ZfYDyZpAERGms97dWUKqpdk96I9dQrv0X2HuoFZno2wRMyL81HyDyiVpwTQCLk5L7N1ExDdurc4q8+PZJlkRHEO431XhkD9IV4aUTHMuvW/ioSKmuhYjL94c1EV2kBDare2WAEp3ndZR0iYaK311B/whDMGK+wFSls0nAmchdLAYLTb+gtOCjyxEj3VKjl0aykbmNJl6BXQyXICBi4WFtPv4MdvQMmiAN3k7GG0ZMqwz1DK5Rw92jIsBhDIlZpSWfFoxuVZfSzHOg+G7UyyfNoxu49ib1W7r8N8dhYSIvC5e8utyAgU9/f+7U3Y/LRbIqZentDoKOBIsBpxewcGy08an/urorwcgZAHx9TGndEBKH+cTfxNRzGrHMbv6VN5otzSbTo9gpnoh9RAfLUm29q4lD8Tu2nMwA== 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)(396003)(346002)(136003)(376002)(39860400002)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(82310400011)(40470700004)(36840700001)(46966006)(82740400003)(81166007)(356005)(44144004)(6506007)(33964004)(40460700003)(40480700001)(36860700001)(86362001)(36756003)(4743002)(336012)(26005)(44832011)(70206006)(2616005)(107886003)(6512007)(83380400001)(2906002)(478600001)(6486002)(316002)(8936002)(4326008)(8676002)(41300700001)(6916009)(70586007)(5660300002)(15650500001)(235185007)(47076005)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Nov 2023 07:39:37.4706 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 12a933cc-c869-4da0-5b39-08dbde9b875c 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: AM4PEPF00027A63.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB6276 X-Spam-Status: No, score=-12.0 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: 1781799508166365811 X-GMAIL-MSGID: 1781799508166365811 Hi All, This adds support to vectorizable_live_reduction to handle multiple exits by doing a search for which exit the live value should be materialized in. Additinally which value in the index we're after depends on whether the exit it's materialized in is an early exit or whether the loop's main exit is different from the loop's natural one (i.e. the one with the same src block as the latch). In those two cases we want the first rather than the last value as we're going to restart the iteration in the scalar loop. For VLA this means we need to reverse both the mask and vector since there's only a way to get the last active element and not the first. Bootstrapped Regtested on aarch64-none-linux-gnu and no issues. Ok for master? Thanks, Tamar gcc/ChangeLog: * tree-vect-loop.cc (vectorizable_live_operation): Support early exits. * tree-vect-stmts.cc (perm_mask_for_reverse): Expose. * tree-vectorizer.h (perm_mask_for_reverse): Expose. --- inline copy of patch -- diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index c123398aad207082384a2079c5234033c3d825ea..55d6aee3d29151e6b528f6fdde15c693e5bdd847 100644 --- diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index c123398aad207082384a2079c5234033c3d825ea..55d6aee3d29151e6b528f6fdde15c693e5bdd847 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -10503,12 +10503,56 @@ vectorizable_live_operation (vec_info *vinfo, stmt_vec_info stmt_info, lhs' = new_tree; */ class loop *loop = LOOP_VINFO_LOOP (loop_vinfo); - basic_block exit_bb = LOOP_VINFO_IV_EXIT (loop_vinfo)->dest; + /* A value can only be live in one exit. So figure out which one. */ + edge exit_e = LOOP_VINFO_IV_EXIT (loop_vinfo); + /* Check if we have a loop where the chosen exit is not the main exit, + in these cases for an early break we restart the iteration the vector code + did. For the live values we want the value at the start of the iteration + rather than at the end. */ + bool inverted_ctrl_p = false; + if (LOOP_VINFO_EARLY_BREAKS (loop_vinfo)) + { + FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, lhs) + if (!is_gimple_debug (use_stmt) + && !flow_bb_inside_loop_p (loop, gimple_bb (use_stmt))) + { + basic_block use_bb = gimple_bb (use_stmt); + for (auto edge : get_loop_exit_edges (loop)) + { + /* Alternative exits can have an intermediate BB in + between to update the IV. In those cases we need to + look one block further. */ + if (use_bb == edge->dest + || (single_succ_p (edge->dest) + && use_bb == single_succ (edge->dest))) + { + exit_e = edge; + goto found; + } + } + } +found: + /* If the edge isn't a single pred then split the edge so we have a + location to place the live operations. Perhaps we should always + split during IV updating. But this way the CFG is cleaner to + follow. */ + inverted_ctrl_p = !vect_is_loop_exit_latch_pred (exit_e, loop); + if (!single_pred_p (exit_e->dest)) + exit_e = single_pred_edge (split_edge (exit_e)); + + /* For early exit where the exit is not in the BB that leads to the + latch then we're restarting the iteration in the scalar loop. So + get the first live value. */ + if (inverted_ctrl_p) + bitstart = build_zero_cst (TREE_TYPE (bitstart)); + } + + basic_block exit_bb = exit_e->dest; gcc_assert (single_pred_p (exit_bb)); tree vec_lhs_phi = copy_ssa_name (vec_lhs); gimple *phi = create_phi_node (vec_lhs_phi, exit_bb); - SET_PHI_ARG_DEF (phi, LOOP_VINFO_IV_EXIT (loop_vinfo)->dest_idx, vec_lhs); + SET_PHI_ARG_DEF (phi, exit_e->dest_idx, vec_lhs); gimple_seq stmts = NULL; tree new_tree; @@ -10539,6 +10583,12 @@ vectorizable_live_operation (vec_info *vinfo, stmt_vec_info stmt_info, tree last_index = gimple_build (&stmts, PLUS_EXPR, TREE_TYPE (len), len, bias_minus_one); + /* This needs to implement extraction of the first index, but not sure + how the LEN stuff works. At the moment we shouldn't get here since + there's no LEN support for early breaks. But guard this so there's + no incorrect codegen. */ + gcc_assert (!LOOP_VINFO_EARLY_BREAKS (loop_vinfo)); + /* SCALAR_RES = VEC_EXTRACT . */ tree scalar_res = gimple_build (&stmts, CFN_VEC_EXTRACT, TREE_TYPE (vectype), @@ -10563,8 +10613,37 @@ vectorizable_live_operation (vec_info *vinfo, stmt_vec_info stmt_info, &LOOP_VINFO_MASKS (loop_vinfo), 1, vectype, 0); gimple_seq_add_seq (&stmts, tem); - tree scalar_res = gimple_build (&stmts, CFN_EXTRACT_LAST, scalar_type, - mask, vec_lhs_phi); + tree scalar_res; + + /* For an inverted control flow with early breaks we want EXTRACT_FIRST + instead of EXTRACT_LAST. Emulate by reversing the vector and mask. */ + if (inverted_ctrl_p && LOOP_VINFO_EARLY_BREAKS (loop_vinfo)) + { + auto gsi_stmt = gsi_last (stmts); + + /* First create the permuted mask. */ + tree perm_mask = perm_mask_for_reverse (TREE_TYPE (mask)); + tree perm_dest = copy_ssa_name (mask); + gimple *perm_stmt + = gimple_build_assign (perm_dest, VEC_PERM_EXPR, mask, + mask, perm_mask); + vect_finish_stmt_generation (vinfo, stmt_info, perm_stmt, + &gsi_stmt); + mask = perm_dest; + + /* Then permute the vector contents. */ + tree perm_elem = perm_mask_for_reverse (vectype); + perm_dest = copy_ssa_name (vec_lhs_phi); + perm_stmt + = gimple_build_assign (perm_dest, VEC_PERM_EXPR, vec_lhs_phi, + vec_lhs_phi, perm_elem); + vect_finish_stmt_generation (vinfo, stmt_info, perm_stmt, + &gsi_stmt); + vec_lhs_phi = perm_dest; + } + + scalar_res = gimple_build (&stmts, CFN_EXTRACT_LAST, scalar_type, + mask, vec_lhs_phi); /* Convert the extracted vector element to the scalar type. */ new_tree = gimple_convert (&stmts, lhs_type, scalar_res); diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index 42cebb92789247434a91cb8e74c0557e75d1ea2c..36aeca60a22cfaea8d3b43348000d75de1d525c7 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -1765,7 +1765,7 @@ compare_step_with_zero (vec_info *vinfo, stmt_vec_info stmt_info) /* If the target supports a permute mask that reverses the elements in a vector of type VECTYPE, return that mask, otherwise return null. */ -static tree +tree perm_mask_for_reverse (tree vectype) { poly_uint64 nunits = TYPE_VECTOR_SUBPARTS (vectype); diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index d8b532c4b8ca92a856368a686598859fab9d40e9..a570cf113adb8e11e5383d4ba7600bddaddbd8c4 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -2245,6 +2245,7 @@ extern bool vect_is_simple_use (vec_info *, stmt_vec_info, slp_tree, enum vect_def_type *, tree *, stmt_vec_info * = NULL); extern bool vect_maybe_update_slp_op_vectype (slp_tree, tree); +extern tree perm_mask_for_reverse (tree); extern bool supportable_widening_operation (vec_info*, code_helper, stmt_vec_info, tree, tree, code_helper*, code_helper*, --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -10503,12 +10503,56 @@ vectorizable_live_operation (vec_info *vinfo, stmt_vec_info stmt_info, lhs' = new_tree; */ class loop *loop = LOOP_VINFO_LOOP (loop_vinfo); - basic_block exit_bb = LOOP_VINFO_IV_EXIT (loop_vinfo)->dest; + /* A value can only be live in one exit. So figure out which one. */ + edge exit_e = LOOP_VINFO_IV_EXIT (loop_vinfo); + /* Check if we have a loop where the chosen exit is not the main exit, + in these cases for an early break we restart the iteration the vector code + did. For the live values we want the value at the start of the iteration + rather than at the end. */ + bool inverted_ctrl_p = false; + if (LOOP_VINFO_EARLY_BREAKS (loop_vinfo)) + { + FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, lhs) + if (!is_gimple_debug (use_stmt) + && !flow_bb_inside_loop_p (loop, gimple_bb (use_stmt))) + { + basic_block use_bb = gimple_bb (use_stmt); + for (auto edge : get_loop_exit_edges (loop)) + { + /* Alternative exits can have an intermediate BB in + between to update the IV. In those cases we need to + look one block further. */ + if (use_bb == edge->dest + || (single_succ_p (edge->dest) + && use_bb == single_succ (edge->dest))) + { + exit_e = edge; + goto found; + } + } + } +found: + /* If the edge isn't a single pred then split the edge so we have a + location to place the live operations. Perhaps we should always + split during IV updating. But this way the CFG is cleaner to + follow. */ + inverted_ctrl_p = !vect_is_loop_exit_latch_pred (exit_e, loop); + if (!single_pred_p (exit_e->dest)) + exit_e = single_pred_edge (split_edge (exit_e)); + + /* For early exit where the exit is not in the BB that leads to the + latch then we're restarting the iteration in the scalar loop. So + get the first live value. */ + if (inverted_ctrl_p) + bitstart = build_zero_cst (TREE_TYPE (bitstart)); + } + + basic_block exit_bb = exit_e->dest; gcc_assert (single_pred_p (exit_bb)); tree vec_lhs_phi = copy_ssa_name (vec_lhs); gimple *phi = create_phi_node (vec_lhs_phi, exit_bb); - SET_PHI_ARG_DEF (phi, LOOP_VINFO_IV_EXIT (loop_vinfo)->dest_idx, vec_lhs); + SET_PHI_ARG_DEF (phi, exit_e->dest_idx, vec_lhs); gimple_seq stmts = NULL; tree new_tree; @@ -10539,6 +10583,12 @@ vectorizable_live_operation (vec_info *vinfo, stmt_vec_info stmt_info, tree last_index = gimple_build (&stmts, PLUS_EXPR, TREE_TYPE (len), len, bias_minus_one); + /* This needs to implement extraction of the first index, but not sure + how the LEN stuff works. At the moment we shouldn't get here since + there's no LEN support for early breaks. But guard this so there's + no incorrect codegen. */ + gcc_assert (!LOOP_VINFO_EARLY_BREAKS (loop_vinfo)); + /* SCALAR_RES = VEC_EXTRACT . */ tree scalar_res = gimple_build (&stmts, CFN_VEC_EXTRACT, TREE_TYPE (vectype), @@ -10563,8 +10613,37 @@ vectorizable_live_operation (vec_info *vinfo, stmt_vec_info stmt_info, &LOOP_VINFO_MASKS (loop_vinfo), 1, vectype, 0); gimple_seq_add_seq (&stmts, tem); - tree scalar_res = gimple_build (&stmts, CFN_EXTRACT_LAST, scalar_type, - mask, vec_lhs_phi); + tree scalar_res; + + /* For an inverted control flow with early breaks we want EXTRACT_FIRST + instead of EXTRACT_LAST. Emulate by reversing the vector and mask. */ + if (inverted_ctrl_p && LOOP_VINFO_EARLY_BREAKS (loop_vinfo)) + { + auto gsi_stmt = gsi_last (stmts); + + /* First create the permuted mask. */ + tree perm_mask = perm_mask_for_reverse (TREE_TYPE (mask)); + tree perm_dest = copy_ssa_name (mask); + gimple *perm_stmt + = gimple_build_assign (perm_dest, VEC_PERM_EXPR, mask, + mask, perm_mask); + vect_finish_stmt_generation (vinfo, stmt_info, perm_stmt, + &gsi_stmt); + mask = perm_dest; + + /* Then permute the vector contents. */ + tree perm_elem = perm_mask_for_reverse (vectype); + perm_dest = copy_ssa_name (vec_lhs_phi); + perm_stmt + = gimple_build_assign (perm_dest, VEC_PERM_EXPR, vec_lhs_phi, + vec_lhs_phi, perm_elem); + vect_finish_stmt_generation (vinfo, stmt_info, perm_stmt, + &gsi_stmt); + vec_lhs_phi = perm_dest; + } + + scalar_res = gimple_build (&stmts, CFN_EXTRACT_LAST, scalar_type, + mask, vec_lhs_phi); /* Convert the extracted vector element to the scalar type. */ new_tree = gimple_convert (&stmts, lhs_type, scalar_res); diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index 42cebb92789247434a91cb8e74c0557e75d1ea2c..36aeca60a22cfaea8d3b43348000d75de1d525c7 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -1765,7 +1765,7 @@ compare_step_with_zero (vec_info *vinfo, stmt_vec_info stmt_info) /* If the target supports a permute mask that reverses the elements in a vector of type VECTYPE, return that mask, otherwise return null. */ -static tree +tree perm_mask_for_reverse (tree vectype) { poly_uint64 nunits = TYPE_VECTOR_SUBPARTS (vectype); diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index d8b532c4b8ca92a856368a686598859fab9d40e9..a570cf113adb8e11e5383d4ba7600bddaddbd8c4 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -2245,6 +2245,7 @@ extern bool vect_is_simple_use (vec_info *, stmt_vec_info, slp_tree, enum vect_def_type *, tree *, stmt_vec_info * = NULL); extern bool vect_maybe_update_slp_op_vectype (slp_tree, tree); +extern tree perm_mask_for_reverse (tree); extern bool supportable_widening_operation (vec_info*, code_helper, stmt_vec_info, tree, tree, code_helper*, code_helper*,