From patchwork Thu Jan 11 07:46:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamar Christina X-Patchwork-Id: 1885406 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=JMkFtU9K; 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=JMkFtU9K; 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 4T9cFs0nJlz1yPt for ; Thu, 11 Jan 2024 18:47:27 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E93663857833 for ; Thu, 11 Jan 2024 07:47:23 +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-db3eur04on2063.outbound.protection.outlook.com [40.107.6.63]) by sourceware.org (Postfix) with ESMTPS id B5B3F3858004 for ; Thu, 11 Jan 2024 07:47:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B5B3F3858004 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 B5B3F3858004 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.6.63 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1704959225; cv=pass; b=GknOnGnrt8fg8YCUe8uKZ6m74XpNohAiMl9DmTkL8DtALKBN0+wjlNf3yIrOHP6SHEmunFELLOWojQwZ0IpZ3p9sUrF92qtA14Nb4jedNtzsXTOFpTtghv+1fEr9BQB3Uy8EkqN9SddT4qKDurGWHRxHO3l71H0DCUDI/M7YvWs= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1704959225; c=relaxed/simple; bh=WSdbVgkRhyJ4XorDmGqN/5Xi4DRdhSE9sFGeAdUBnRc=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:Message-ID: MIME-Version; b=ORdl0nhOt4fuGmGD2X6AwiraqP7hDC1ByN9yjw2xSDnX+7HaioH5CwxnXE8EB1HOoph5u6TKGG3aYSOY+PUCBbOKAGMyBlJ3JkouZQXpIKVc2SXhApDTmBKIGitwetXT0bafaiCWbIh1KV3Oh+6xAVbKFzt8k3j2FovShD8jxxM= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=hHz+ALQy+VofwqemdPLN0Pu+p5pLXco5kC6xqguv18czBjqrKR2xAISGAMk7dL6mHZAMdNUWkbNCimtS8dnaP1WeL3rXsJlkjpyc4iiKr8AgsbBHLFF3XUW6bxLUhrHz31etbpAd52dg+19TtNT4RWFPSEE26HU0oZnWgQTiwFLErRvES8fAldHad+3hixy0UwS716KsttSg/520W398+LJ192bQh36srmmp03KLLszcyAeBIf5Oor9UCq8zLndk8/EjoBNnuDZ/h+QJ4aRtxtEsATkTWdaBgz81/cUoNF8U2UmqU6iNLqn/6gLL53kFQNAJWuiQG8Py9TS9AqM0Rg== 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=VhXNitUzTBGObb716L702RL0mXl3WWxsVSFra/1zvro=; b=bGk6JkkwRsDv1is+YvEDk6x9sXR1Juhrul7yK6yYp9Af7y5TazEzWhF6FxIHHHMRDyOtMSVYPyd11UvzmdP8xmvMHCXt5p8F6diFUSsfykbSsUyzsxmeHlHvLZsfurmmF6D6ou54B0Q2zubwqmaodPriSbl4G0s0qQnFlu68XB5oPBtTTecAAMk0P75QvOPDqEPBFQP9mcGfJsPHiBaX69m4T7CvpY3bIhMZXpoGDRJzRmG8HpbjiMalLVVypg8VyK3zIaEzzcr0cYTfwHDdf4cYVTYLP4CcZql97mGF0ldy8PX9ql05fbRuq8y2EYaOOk1uXMJxTddghSmm45c/YA== 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=VhXNitUzTBGObb716L702RL0mXl3WWxsVSFra/1zvro=; b=JMkFtU9K/fvb0gF4CdjCX2RyIVf/+hVwOEgWXZiq1w5YvIacVo3Eb8fVLVFS41Jt8t0n8bjk1RzR1nXcSQawRlCHPuHCI1Gev/dkrmqLVZSXaKx0lEFe1M3QuDiDh8Gr2JtPE5HDJbYgPQPzkgXBT3slr/0uH/uziwM+GtoML4A= Received: from DB9PR01CA0013.eurprd01.prod.exchangelabs.com (2603:10a6:10:1d8::18) by AS1PR08MB7563.eurprd08.prod.outlook.com (2603:10a6:20b:472::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.23; Thu, 11 Jan 2024 07:47:00 +0000 Received: from DU6PEPF0000B61D.eurprd02.prod.outlook.com (2603:10a6:10:1d8:cafe::3) by DB9PR01CA0013.outlook.office365.com (2603:10a6:10:1d8::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.19 via Frontend Transport; Thu, 11 Jan 2024 07:46:59 +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 DU6PEPF0000B61D.mail.protection.outlook.com (10.167.8.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.14 via Frontend Transport; Thu, 11 Jan 2024 07:46:59 +0000 Received: ("Tessian outbound 1076c872ecc6:v228"); Thu, 11 Jan 2024 07:46:58 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 690a13ff3a814d35 X-CR-MTA-TID: 64aa7808 Received: from 9bfaec119970.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id B594E163-C4C4-401A-980E-2D082EEEAD54.1; Thu, 11 Jan 2024 07:46:52 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 9bfaec119970.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 11 Jan 2024 07:46:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IHKoWn/ksRiI6Dq2Y10rmzq46ZPza0yBoammAyIbM3gwXXL0Cq65CWpFI/hPfDSo76EXqZE2j1OUTxaarUG4ET4lXOllNE0QQXpa0z/5WK4L+j2qvF5ojzAbpQcElpiMUzzBZyKjLKXryfr/mk1LDPZdCHJEuhE4WxPND/abAWJTizXhosy2ha1eezQ5nLZcxdRo0EetdmWdDLRhUfSG6QfuVvzYVWnBdqgzm899uPvV7OMIZz9tflmVBlvaCTvCM8XHO7dd8Tq4vdtqRcpucx9ZzG1E3Efh73QPbV/UesiTIvTUro9A4MsZRqzRindN/w0tQjUDxsLd9sVjV9keKA== 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=VhXNitUzTBGObb716L702RL0mXl3WWxsVSFra/1zvro=; b=mIzlGHsrZ+3IUSWsvsTac/Kmxqa2ccy2BaZWEdz69qKb8JZllTnaMEGH83BMdudniKOmA6CTfcGsoMpyGvSMmKqu9M5sh3Do6ndz+eNJyX+qzoq7imwnMWU0JXu4esQo059Vrd2AgkXNzBMy1TrPoV8V+ta3GdFnklidGlcJqTQKWjghxD/GFkxPve9TWvj8/rNkftqZuwU1WaUR7BaF0kxM/tLyp9oWdJnplWKoEnuS3fvgbI6AT3HxP2abH+u64xmwxPoOpi6Sj8IaG0pNhAaLwbd8nZUPxYt8vclETi4zcjSueWOP3W6b5ccniOhdZAIsR4U+DiDPu8DCBblZnw== 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=VhXNitUzTBGObb716L702RL0mXl3WWxsVSFra/1zvro=; b=JMkFtU9K/fvb0gF4CdjCX2RyIVf/+hVwOEgWXZiq1w5YvIacVo3Eb8fVLVFS41Jt8t0n8bjk1RzR1nXcSQawRlCHPuHCI1Gev/dkrmqLVZSXaKx0lEFe1M3QuDiDh8Gr2JtPE5HDJbYgPQPzkgXBT3slr/0uH/uziwM+GtoML4A= 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 GV1PR08MB10808.eurprd08.prod.outlook.com (2603:10a6:150:160::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.19; Thu, 11 Jan 2024 07:46:49 +0000 Received: from VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::810c:8495:3f0a:ef8]) by VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::810c:8495:3f0a:ef8%6]) with mapi id 15.20.7181.015; Thu, 11 Jan 2024 07:46:49 +0000 Date: Thu, 11 Jan 2024 07:46:47 +0000 From: Tamar Christina To: gcc-patches@gcc.gnu.org Cc: nd@arm.com, rguenther@suse.de, jlaw@ventanamicro.com Subject: [PATCH]middle-end: fill in reduction PHI for all alt exits [PR113144] Message-ID: Content-Disposition: inline X-ClientProxiedBy: LO4P302CA0022.GBRP302.PROD.OUTLOOK.COM (2603:10a6:600:2c1::7) To VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB5325:EE_|GV1PR08MB10808:EE_|DU6PEPF0000B61D:EE_|AS1PR08MB7563:EE_ X-MS-Office365-Filtering-Correlation-Id: 6b27cfc7-d77a-4e4d-a945-08dc12797dcd 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: mOjqd2pnh//qp6sYnBjBreHNDZWygssrcHa5IR9OAh5ZAOHZF88MHEL+eAO0E04lMCeEw5LqYXwjSz4lRCn9/i04G5YJmgEYAAZBwSe55bVRzhGMAeLolnCFz+hY1YPzX9sOsxV+0KxCB+nNoK86MPeGcnUSgAlh8r0/WPwgD/9vnL7mXUAhrQE+fySaz2A2foPahQjLHoqnoMRFgKAjogSAhtl8aIGDPtv8ZC8MXQrelM5DVnFGghRN5qTGIzyFKxPBhg/aDbCg6TGJCEFP08CLA0rLXRQQ12+T2+4lPk8iImEHu9PXQ2T4s80x9UyYAIDSOPRWlOYSlLzGs2WfwOcvbWDUuAuCa5/PP6DHsOnNRFg5wTaUuC1c+uGFSbRcIum2waRvTWkAFaB84I3smB2Q+aOHQxNtJNcnAKedSSvEy37ibPoxKIdaeM5iZnn/GKSlUMLbF2FVI6Av+nqEu8VwYjPyrctiApWDuuDC/aNKM60vgopImQqJsTJYP8/8AIEZqV2PUfj+qaGlXuIXPVeFZ6jJ5N12/+EoM2w5hRo+fB/prrMFuxI6ghgvH3heHD6aNSaUv78JkFjKypPubPcnjZdYeYljAopBXTB98Yq4T4usSqnL00Whuxd8lQjSZYZT72cRYQvKGzI9JIKN3B9rbr7INoWvMkyIlG+8rsQ= 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)(346002)(136003)(366004)(376002)(396003)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(38100700002)(26005)(4743002)(2616005)(44144004)(8676002)(4326008)(8936002)(5660300002)(235185007)(41300700001)(2906002)(44832011)(6486002)(6916009)(33964004)(6512007)(6506007)(478600001)(66476007)(316002)(66556008)(66946007)(36756003)(86362001)(84970400001)(4216001)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR08MB10808 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: DU6PEPF0000B61D.eurprd02.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: b9b522f2-d79e-4334-e820-08dc12797805 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Qne8OKCfMGK/qGPZxsUuKy5p9xUfN3k9WOvJLGetOxqkQ3Bc8K/6eJVcJ+BgqN/+Y8SEU8FC9BKaMVLGF2QDGLwoMgheS87je94nvggkrHYP8gWr8gNrtnFD8nkP60ZjjvrQvsmaUSCPgZvT/Zse0pmP7vudiWyHeMZaZjq2xac1hSvZ6/WeHB9LVpCM+BwhMCYXXas9dQzZO+Ial/zzLq98Av8AE6Rhs5L0VKawswW4LsLHbKaEAbbUCOQ5pA6nnkpPW6vJO8ZqGABkWv48mUMCeOSvyfAKgWj4jJ4wEgRyyvPuWYltE7Po57JBJn9GwF4HPyxWbm3IHp+DW3uR2QilyCShsDZ4y79SUy/G3Yxo2pDNbzs1Bh/1Z238u4kO1hqdk/USoj49hsrg7+Q2WEXdJRXRHdRJq3LhO8sFMLmBiueRC1tbMt5q3gu0S9DFWTTfwNUUJ449CC3ESFHgRPcmRNa818vCd48gyAjHcF6VIuCWzV9aP4/I9nydFf3er/PjSlGM09xOo0SopjVU0gPLQajSfre89ovcYdLB0WkmjA22xLIdArLxdZiajmD/t2Ao0rxr/ba2Xd2TQP99sUbSXcAVQgmGNNDznK/Je3gVvw+OsEsA0ADd5OW9JLVPHN+/fSGgLTr8mFAiH5ydMVelQPAvNe6TVh/8eB5gWWxNFQoiXjGDsUHdeCRYYT0X6a3b6ZLWkAUlXHl/VTte3dtZvWm5Bh7Dc3Sx8d3PjAGm9pijqYH4u9xQnbDOBcsXFQawC8ihU/pcrewwVo2I3b3k4hT5DdoLV70O9MU36KQhX/FMXkCo5gYDVdNLIffR 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)(39860400002)(136003)(346002)(376002)(230922051799003)(64100799003)(82310400011)(186009)(1800799012)(451199024)(36840700001)(46966006)(40470700004)(6512007)(6506007)(40460700003)(33964004)(40480700001)(84970400001)(44144004)(5660300002)(70206006)(70586007)(82740400003)(6486002)(8936002)(8676002)(4326008)(478600001)(44832011)(316002)(235185007)(107886003)(2616005)(2906002)(4743002)(6916009)(336012)(26005)(47076005)(36860700001)(356005)(81166007)(86362001)(41300700001)(36756003)(4216001)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jan 2024 07:46:59.0740 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6b27cfc7-d77a-4e4d-a945-08dc12797dcd 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: DU6PEPF0000B61D.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR08MB7563 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Hi All, When we have a loop with more than 2 exits and a reduction I forgot to fill in the PHI value for all alternate exits. All alternate exits use the same PHI value so we should loop over the new PHI elements and copy the value across since we call the reduction calculation code only once for all exits. This was normally covered up by earlier parts of the compiler rejecting loops incorrectly (which has been fixed now). Note that while I can use the loop in all cases, the reason I separated out the main and alt exit is so that if you pass the wrong edge the macro will assert. Bootstrapped Regtested on aarch64-none-linux-gnu, x86_64-pc-linux-gnu and no issues. Ok for master? Thanks, Tamar gcc/ChangeLog: PR tree-optimization/113178 * tree-vect-loop.cc (vect_create_epilog_for_reduction): Fill in all alternate exits. gcc/testsuite/ChangeLog: PR tree-optimization/113178 * g++.dg/vect/vect-early-break_6-pr113178.cc: New test. * gcc.dg/vect/vect-early-break_101-pr113178.c: New test. * gcc.dg/vect/vect-early-break_102-pr113178.c: New test. --- inline copy of patch -- diff --git a/gcc/testsuite/g++.dg/vect/vect-early-break_6-pr113178.cc b/gcc/testsuite/g++.dg/vect/vect-early-break_6-pr113178.cc new file mode 100644 index 0000000000000000000000000000000000000000..da008759a72dd563bf4930decd74470ae35cb98e --- diff --git a/gcc/testsuite/g++.dg/vect/vect-early-break_6-pr113178.cc b/gcc/testsuite/g++.dg/vect/vect-early-break_6-pr113178.cc new file mode 100644 index 0000000000000000000000000000000000000000..da008759a72dd563bf4930decd74470ae35cb98e --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/vect-early-break_6-pr113178.cc @@ -0,0 +1,34 @@ +/* { dg-do compile } */ +/* { dg-add-options vect_early_break } */ +/* { dg-require-effective-target vect_early_break } */ +/* { dg-require-effective-target vect_int } */ + +struct PixelWeight { + int m_SrcStart; + int m_Weights[]; +}; +struct CWeightTable { + int *GetValueFromPixelWeight(PixelWeight *, int) const; +}; +char ContinueStretchHorz_dest_scan; +struct CStretchEngine { + bool ContinueStretchHorz(); + CWeightTable m_WeightTable; +}; +int *CWeightTable::GetValueFromPixelWeight(PixelWeight *pWeight, + int index) const { + long __trans_tmp_1; + if (index < pWeight->m_SrcStart) + return __trans_tmp_1 ? &pWeight->m_Weights[pWeight->m_SrcStart] : nullptr; +} +bool CStretchEngine::ContinueStretchHorz() { + { + PixelWeight pPixelWeights; + int dest_g_m; + for (int j; j; j++) { + int pWeight = *m_WeightTable.GetValueFromPixelWeight(&pPixelWeights, j); + dest_g_m += pWeight; + } + ContinueStretchHorz_dest_scan = dest_g_m; + } +} diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_101-pr113178.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_101-pr113178.c new file mode 100644 index 0000000000000000000000000000000000000000..8b91112133f0522270bb4d92664355838a405aaf --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_101-pr113178.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 } */ + +struct PixelWeight { + int m_SrcStart; + int m_Weights[16]; +}; +char h; +void f(struct PixelWeight *pPixelWeights) { + int dest_g_m; + long tt; + for (int j = 0; j < 16; j++) { + int *p = 0; + if (j < pPixelWeights->m_SrcStart) + p = tt ? &pPixelWeights->m_Weights[0] : 0; + int pWeight = *p; + dest_g_m += pWeight; + } + h = dest_g_m; +} diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_102-pr113178.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_102-pr113178.c new file mode 100644 index 0000000000000000000000000000000000000000..ad7582e440720e50a2769239c88b1e07517e4c10 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_102-pr113178.c @@ -0,0 +1,19 @@ +/* { 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 "-std=gnu99 -fpermissive -fgnu89-inline -Ofast -fprofile-generate -w" } */ + +extern int replace_reg_with_saved_mem_i, replace_reg_with_saved_mem_nregs, + replace_reg_with_saved_mem_mem_1; +replace_reg_with_saved_mem_mode() { + if (replace_reg_with_saved_mem_i) + return; + while (++replace_reg_with_saved_mem_i < replace_reg_with_saved_mem_nregs) + if (replace_reg_with_saved_mem_i) + break; + if (replace_reg_with_saved_mem_i) + if (replace_reg_with_saved_mem_mem_1) + adjust_address_1(); + replace_reg_with_saved_mem_mem_1 ? fancy_abort() : 0; +} diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index 27bb28365936978013a576b64b72d9e92375f361..da2dfa176ecd457ebc11d1131302ca15d77d779d 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -6223,7 +6223,13 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo, phi = create_phi_node (new_def, exit_bb); if (j) def = gimple_get_lhs (vec_stmts[j]); - SET_PHI_ARG_DEF (phi, loop_exit->dest_idx, def); + if (LOOP_VINFO_IV_EXIT (loop_vinfo) == loop_exit) + SET_PHI_ARG_DEF (phi, loop_exit->dest_idx, def); + else + { + for (unsigned k = 0; k < gimple_phi_num_args (phi); k++) + SET_PHI_ARG_DEF (phi, k, def); + } new_def = gimple_convert (&stmts, vectype, new_def); reduc_inputs.quick_push (new_def); } --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/vect-early-break_6-pr113178.cc @@ -0,0 +1,34 @@ +/* { dg-do compile } */ +/* { dg-add-options vect_early_break } */ +/* { dg-require-effective-target vect_early_break } */ +/* { dg-require-effective-target vect_int } */ + +struct PixelWeight { + int m_SrcStart; + int m_Weights[]; +}; +struct CWeightTable { + int *GetValueFromPixelWeight(PixelWeight *, int) const; +}; +char ContinueStretchHorz_dest_scan; +struct CStretchEngine { + bool ContinueStretchHorz(); + CWeightTable m_WeightTable; +}; +int *CWeightTable::GetValueFromPixelWeight(PixelWeight *pWeight, + int index) const { + long __trans_tmp_1; + if (index < pWeight->m_SrcStart) + return __trans_tmp_1 ? &pWeight->m_Weights[pWeight->m_SrcStart] : nullptr; +} +bool CStretchEngine::ContinueStretchHorz() { + { + PixelWeight pPixelWeights; + int dest_g_m; + for (int j; j; j++) { + int pWeight = *m_WeightTable.GetValueFromPixelWeight(&pPixelWeights, j); + dest_g_m += pWeight; + } + ContinueStretchHorz_dest_scan = dest_g_m; + } +} diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_101-pr113178.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_101-pr113178.c new file mode 100644 index 0000000000000000000000000000000000000000..8b91112133f0522270bb4d92664355838a405aaf --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_101-pr113178.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 } */ + +struct PixelWeight { + int m_SrcStart; + int m_Weights[16]; +}; +char h; +void f(struct PixelWeight *pPixelWeights) { + int dest_g_m; + long tt; + for (int j = 0; j < 16; j++) { + int *p = 0; + if (j < pPixelWeights->m_SrcStart) + p = tt ? &pPixelWeights->m_Weights[0] : 0; + int pWeight = *p; + dest_g_m += pWeight; + } + h = dest_g_m; +} diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_102-pr113178.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_102-pr113178.c new file mode 100644 index 0000000000000000000000000000000000000000..ad7582e440720e50a2769239c88b1e07517e4c10 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_102-pr113178.c @@ -0,0 +1,19 @@ +/* { 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 "-std=gnu99 -fpermissive -fgnu89-inline -Ofast -fprofile-generate -w" } */ + +extern int replace_reg_with_saved_mem_i, replace_reg_with_saved_mem_nregs, + replace_reg_with_saved_mem_mem_1; +replace_reg_with_saved_mem_mode() { + if (replace_reg_with_saved_mem_i) + return; + while (++replace_reg_with_saved_mem_i < replace_reg_with_saved_mem_nregs) + if (replace_reg_with_saved_mem_i) + break; + if (replace_reg_with_saved_mem_i) + if (replace_reg_with_saved_mem_mem_1) + adjust_address_1(); + replace_reg_with_saved_mem_mem_1 ? fancy_abort() : 0; +} diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index 27bb28365936978013a576b64b72d9e92375f361..da2dfa176ecd457ebc11d1131302ca15d77d779d 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -6223,7 +6223,13 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo, phi = create_phi_node (new_def, exit_bb); if (j) def = gimple_get_lhs (vec_stmts[j]); - SET_PHI_ARG_DEF (phi, loop_exit->dest_idx, def); + if (LOOP_VINFO_IV_EXIT (loop_vinfo) == loop_exit) + SET_PHI_ARG_DEF (phi, loop_exit->dest_idx, def); + else + { + for (unsigned k = 0; k < gimple_phi_num_args (phi); k++) + SET_PHI_ARG_DEF (phi, k, def); + } new_def = gimple_convert (&stmts, vectype, new_def); reduc_inputs.quick_push (new_def); }