From patchwork Mon Feb 5 13:09:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamar Christina X-Patchwork-Id: 1895265 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=AQtRrDYn; 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=AQtRrDYn; 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 4TT6Db1Ptvz23gM for ; Tue, 6 Feb 2024 00:10:07 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1ECF13857C50 for ; Mon, 5 Feb 2024 13:10:05 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2048.outbound.protection.outlook.com [40.107.21.48]) by sourceware.org (Postfix) with ESMTPS id CB702385841B for ; Mon, 5 Feb 2024 13:09:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CB702385841B 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 CB702385841B Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.21.48 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1707138582; cv=pass; b=O5Xfr21H1DhDRMpmfo0mHxaCOt3sck7xkwy5xV4EcYKw3/eK93Svyhcqdbhh10TgClGLZlH2Nj2jvqm3zMrw2BmFtPzxGRrDajUJMOOnN0gdTGnD9Hqi6F4e+6jtqq7yjCv4vCCizUpnClfeI48CdHjLdP7lH7YiXnJ1R29sL9E= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1707138582; c=relaxed/simple; bh=kPgBt4ttYK8n/9ACrBSIvKsELxlBes6AFAWwq8PzPcE=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:Message-ID: MIME-Version; b=w7BRuf1u89ke+7lih5aBe/hCvLn6siQoxqv3ADzhiGrb2QEB1Nsj+rc4/q+pz0w7ZmEUlWLHRMI2goO09vqgkSONJdar92QSrYb/W/BQ+CW82R2KDCtnNcaI4sXb+n8hjec6+u7dSg7Yu5pPSgWT6BedmNhxABCJw27/G994hkk= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=fVicdIGRed5Bd2G3dRSHMy09iu9XUQ38Li44Qau7rLWrM7VPtI9xlGlkLS6Oi+WRQL+6ZQv3xXhOO0bivxbT3Fg6xlO3WCAKqwmB/dw4CzYvBblthchdLN2tWM+SSLeuaOE4HSDXqpgNRSnZhn/RhjZpU2rBnYxuQs3vZBPOFpg8SnYH89ts6nv4DwcAJok3t/ut0RLstyEMjmZVcPwAJIlt3/yKbgC/JoDJt1oY3C4v0zNWNeih5K9Sh4xwbQyQJ1P8JhO2doWy5SdgKMxaWW8N1gypeYYevAfSaTj6E2+cOzbe2v84KHJzvkQchUNgnYwN6y4JSnVLT1LmWDRP0A== 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=1NcqNH1L8MpeFbVfwqSBFVARm2FJ4UtkluUEss26sNs=; b=Qvr2ADcmz3M5xFT+7XxNBl/y3BkbJs6hqKnNnfQ/IHZ90MfUW/2H2qKMzoVT+Een85b6rYlWSWhz0D6lhQfqlXrnYMe50ZLsrXCTmFviCmwbjF/vMjZDvUD8eD4xJaIR4xNKZgBwST3ckS0JPlBlkyJKhVLZTFWvTvP/Lzb6vL21sYvs/Z8suv6nphvUSYe88/H2IK29XI2QRWxohGF74XU8fUoKtZDZ5PAtoCb4wMD8LSZ2cQE05+aegJ613326VLr3jt2qxWXWMbbZk8g30y8y9naf7Nw7ObD2wj0F+iFZom7KhqxGaGdm4hUacbYV2+wmMuKreYnWjNewoqMAnA== 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=1NcqNH1L8MpeFbVfwqSBFVARm2FJ4UtkluUEss26sNs=; b=AQtRrDYnBE2C98oE8gURlyRqZru3RPuJpcavk2G/Fz1bEge9X9TlgjKgFLhrDb3vAfpWJvaQvpZkNICHMfRGd7hN3FHcbCmrwLnHJarp0qBu1eHnzymxvnuU6NU7KPneF2fP3uxtykrEHNmMtkP5dmKJ20ZzWjlV3bUo6ZAF4Jw= Received: from AS9PR07CA0013.eurprd07.prod.outlook.com (2603:10a6:20b:46c::10) by GV2PR08MB8463.eurprd08.prod.outlook.com (2603:10a6:150:b4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.34; Mon, 5 Feb 2024 13:09:33 +0000 Received: from AM4PEPF00025F9B.EURPRD83.prod.outlook.com (2603:10a6:20b:46c:cafe::e7) by AS9PR07CA0013.outlook.office365.com (2603:10a6:20b:46c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.16 via Frontend Transport; Mon, 5 Feb 2024 13:09:32 +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 AM4PEPF00025F9B.mail.protection.outlook.com (10.167.16.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.0 via Frontend Transport; Mon, 5 Feb 2024 13:09:32 +0000 Received: ("Tessian outbound a297577ee0df:v228"); Mon, 05 Feb 2024 13:09:32 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 29da48480831e62a X-CR-MTA-TID: 64aa7808 Received: from d112c92b6a49.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id BE8DBB49-7B2F-4C8B-AF1C-405DEF273D45.1; Mon, 05 Feb 2024 13:09:25 +0000 Received: from EUR03-AM7-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id d112c92b6a49.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 05 Feb 2024 13:09:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kr+dWbxBBGvdRqai/8FAac99Gqcdup3itcWtvi9TIMuWkvgOVpeYiz23dSjgMfmx7LFiytg2J8dUfRN8TrrA58GWGOt0I6Nf3oIJRhAa6S1SlkUK3pxxxE3rLkeGrYm6dqGHQK7uV+K1Lfx4pw99JtzdJsOANuryTwmMpXo4t+5dZN8ZWvVG1aSoE8laBV8xc+M0D6MVK0Gbx8ZmGhXnXlHbJlJVgBhVr4o9b2BvAr+YzzL+uR4JotkNIQLHZhvzlGJKg5Md/ICsVKsDQdFzrIvhz30E/e5TRAerbPRxol9/f3xpZ1TAAZxfAYRD2rUt52Ad4iPt7U1UqJOlDgL9vg== 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=1NcqNH1L8MpeFbVfwqSBFVARm2FJ4UtkluUEss26sNs=; b=l7Q22OlpnHxjCnOmUPso/8Vg6J2fssUpoVI/kmjcZ+Ehe11EfPsDJ6PyoqZe5Yt6WlmFPBYPkDhSXKx9tdziLHD0QAxCc5wRQHP2S/aWvPL4H3mUSzpLHnROQGc+dTV1azCr4T9Z8TaqO06Zs6EB6aAWXKjMoGqJdHCjhdv+aTKRZVgP+Sz7Ly70oYr7w8h1bDw5p+8ISaBnlphg7swGUzoYYPxbq9I3LadkoqjkWW+O2Ci0z1Xc0IrNbIaOxgYb4s6FkGhtLIyL7F0SVCB1MQY6Lr3ldzh+FsSqKFn7b9fsMkMlm4ypI9sJvvyfTEo18fODayJHAz3Int5TumrATg== 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=1NcqNH1L8MpeFbVfwqSBFVARm2FJ4UtkluUEss26sNs=; b=AQtRrDYnBE2C98oE8gURlyRqZru3RPuJpcavk2G/Fz1bEge9X9TlgjKgFLhrDb3vAfpWJvaQvpZkNICHMfRGd7hN3FHcbCmrwLnHJarp0qBu1eHnzymxvnuU6NU7KPneF2fP3uxtykrEHNmMtkP5dmKJ20ZzWjlV3bUo6ZAF4Jw= 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 PAWPR08MB9856.eurprd08.prod.outlook.com (2603:10a6:102:2ea::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.34; Mon, 5 Feb 2024 13:09:23 +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.7249.032; Mon, 5 Feb 2024 13:09:23 +0000 Date: Mon, 5 Feb 2024 13:09:21 +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 ICE when destination BB for stores starts with a label [PR113750] Message-ID: Content-Disposition: inline X-ClientProxiedBy: LO4P123CA0274.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:195::9) To VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB5325:EE_|PAWPR08MB9856:EE_|AM4PEPF00025F9B:EE_|GV2PR08MB8463:EE_ X-MS-Office365-Filtering-Correlation-Id: 62b79178-8638-455c-f3b4-08dc264bb1e3 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: 1q6fA73IdFWalIaa+XRxzkCaf+SE3ptpFOC6noBhkK5ANn6zCXyTE0PwBS/XJ+MEI/XcreD9HQc+/aAnKmCrYYuOxHuk/da0IBA2NkaA4iGoaNxPsm798BYRmA/vm5GH2lAk/5JC2QqjZWvR2QjMr/GdyaSY6jxqyPSghBDVBheOpMOwZ/b2PA2oyuklSMApilcDeVkSM4IkNs0e6iPCo+rThk91HHr7euerPyhsDr+cIwHe+sJEVF+fw553TQLGOmAXmew+vF2H5tW4PI/xjgOkUjGwDJq8veoY7FOfP5/6XGgh3XLbRj3hA+hqnS4z5I3qfqIWyhwmG7Pu8GgQ2dCzwIZnUw4ThRGn0CYAjmtH6Gz3+e05YAChTWwPoIeGSgmdobPcJj0bVgwARH7MX4xpdnyTUAMKwfk/2JdYySkX94JHW+m4vxhzNmk8/K20bK6Zi8K8sks5X8XOAo3EEEcwTqNTyXYOw6NW+R4BeouMR/qe937MAKz0hsyVWocrtj9qie9I94ch+Co36mLjNINy4DScj7ezD3U3thn2jXfk5Hodb3HMmxGL6QDfY5CctS/22RJs8P5BpaIqoJgNIN+B9LIOi5T8p4MdVZKWciBuw7t1fLxS0NrJ+5eGUxEd2ZGrsKwok+ewQA1QFBnDAHDTpRylulqPZhNuD7CRyDc= 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)(39860400002)(136003)(346002)(376002)(366004)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(41300700001)(8936002)(4326008)(8676002)(5660300002)(235185007)(44832011)(86362001)(6916009)(66946007)(6486002)(66476007)(316002)(66556008)(478600001)(36756003)(2906002)(38100700002)(2616005)(6512007)(33964004)(83380400001)(6506007)(26005)(4743002)(44144004)(84970400001)(4216001)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR08MB9856 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: AM4PEPF00025F9B.EURPRD83.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 0f337d05-8482-4d39-7209-08dc264babe9 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WIBOFI15GdGuuIo8wNMuR6O1i8BSGpNRwJFesHtuyP7ij7CIkIyP7jQR9T387CTqEhOhBhJM6ZpBoDQ7LTm2iAXnw75KPNkz5HO716kLaLUZLwE356y0XbhgfK6r8BTuJ3jNKZR+SHlr13rgak+XG6J5xIhYbaw6tJ51/uWKo0oENspMk9pxQRoip9wuUmFiMFdx+tBAkO1BQMtMtLKdMnSQz6+y4geTGGBLDJTs4x55NulxpiDZwQC9JRfCQZINN6bp/twR7VQOqWgJFsU/FhQDKpDYOwbrHKAXYfMkjeavXhWZEmU2SpLK2NOYNUCpaVuusyp0lTL28FOALz1NBW+wd7YPxBxfcLIopBy1UOAYZUQoshZm86Gqv6zJ+OSJ9GZ5CJ0boKJghnLIAko4rLcpTiGYIlmeZ8rtLipE8mwQJUZDGt6WbhA2W7uZqz2Tz4dckCyzfNq+KfULeSAmeO9Og7KBvh0l2i+2wHaonmoLd+qQx4SP2vwvQw00JIJz22gnU8AyiLo8kRVBzS9RUFk2JNhj3tVME4GK/JfDyluAKtyNkc3fNlDAMgqHzrvsCfBHiVbkd/Cl+l8rj6f3CxD8DjhWYDXPKz77dvbYavEIBK6W5LkPFup7rYn9AGAhIXD0UNoNr4ajWCFOZV2LNWQbVfCzNYkfLK6hDiAd0H9SjUAQksq+qSEEFEJ+Tfq2AgvYE+98DmKpfl8qg33qcEEFquPoTfwuzVf5VNmCbkg0G2QQnvYcdhR2bVaivEyOTaM9HuG/liRzViduU/lbGPOHOaPWFsVmMFDh8VSpiASknMejP5AIYaPwTxfzgCX+ 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)(136003)(39860400002)(346002)(230922051799003)(64100799003)(451199024)(186009)(82310400011)(1800799012)(46966006)(40470700004)(36840700001)(83380400001)(33964004)(44144004)(6506007)(4743002)(6512007)(336012)(47076005)(41300700001)(107886003)(2616005)(26005)(356005)(2906002)(36756003)(8676002)(81166007)(44832011)(235185007)(4326008)(5660300002)(8936002)(6916009)(70586007)(70206006)(316002)(6486002)(478600001)(82740400003)(86362001)(84970400001)(40480700001)(36860700001)(40460700003)(4216001)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Feb 2024 13:09:32.7895 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 62b79178-8638-455c-f3b4-08dc264bb1e3 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: AM4PEPF00025F9B.EURPRD83.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR08MB8463 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, The report shows that if the FE leaves a label as the first thing in the dest BB then we ICE because we move the stores before the label. This is easy to fix if we know that there's still only one way into the BB. We would have already rejected the loop if there was multiple paths into the BB however I added an additional check just for early break in case the other constraints are relaxed later with an explanation. After that we fix the issue just by getting the GSI after the labels and I add a bunch of testcases for different positions the label can be added. Only the vect-early-break_112-pr113750.c one results in the label being kept. Bootstrapped Regtested on aarch64-none-linux-gnu and no issues. Ok for master? Thanks, Tamar gcc/ChangeLog: PR tree-optimization/113750 * tree-vect-data-refs.cc (vect_analyze_early_break_dependences): Check for single predecessor when doing early break vect. * tree-vect-loop.cc (move_early_exit_stmts): Get gsi at the start but after labels. gcc/testsuite/ChangeLog: PR tree-optimization/113750 * gcc.dg/vect/vect-early-break_112-pr113750.c: New test. * gcc.dg/vect/vect-early-break_113-pr113750.c: New test. * gcc.dg/vect/vect-early-break_114-pr113750.c: New test. * gcc.dg/vect/vect-early-break_115-pr113750.c: New test. * gcc.dg/vect/vect-early-break_116-pr113750.c: New test. --- inline copy of patch -- diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_112-pr113750.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_112-pr113750.c new file mode 100644 index 0000000000000000000000000000000000000000..559ebd84d5c39881e694e7c8c31be29d846866ed --- diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_112-pr113750.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_112-pr113750.c new file mode 100644 index 0000000000000000000000000000000000000000..559ebd84d5c39881e694e7c8c31be29d846866ed --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_112-pr113750.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-add-options vect_early_break } */ +/* { dg-require-effective-target vect_early_break } */ +/* { dg-require-effective-target vect_int } */ + +/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */ + +#ifndef N +#define N 800 +#endif +unsigned vect_a[N]; +unsigned vect_b[N]; + +unsigned test4(unsigned x) +{ + unsigned ret = 0; + for (int i = 0; i < N; i++) + { + vect_b[i] = x + i; + if (vect_a[i] != x) + break; +foo: + vect_a[i] = x; + } + return ret; +} diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_113-pr113750.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_113-pr113750.c new file mode 100644 index 0000000000000000000000000000000000000000..ba85780a46b1378aaec238ff9eb5f906be9a44dd --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_113-pr113750.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-add-options vect_early_break } */ +/* { dg-require-effective-target vect_early_break } */ +/* { dg-require-effective-target vect_int } */ + +/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */ + +#ifndef N +#define N 800 +#endif +unsigned vect_a[N]; +unsigned vect_b[N]; + +unsigned test4(unsigned x) +{ + unsigned ret = 0; + for (int i = 0; i < N; i++) + { + vect_b[i] = x + i; + if (vect_a[i] != x) + break; + vect_a[i] = x; +foo: + } + return ret; +} diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_114-pr113750.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_114-pr113750.c new file mode 100644 index 0000000000000000000000000000000000000000..37af2998688f5d60e2cdb372ab43afcaa52a3146 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_114-pr113750.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-add-options vect_early_break } */ +/* { dg-require-effective-target vect_early_break } */ +/* { dg-require-effective-target vect_int } */ + +/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */ + +#ifndef N +#define N 800 +#endif +unsigned vect_a[N]; +unsigned vect_b[N]; + +unsigned test4(unsigned x) +{ + unsigned ret = 0; + for (int i = 0; i < N; i++) + { + vect_b[i] = x + i; +foo: + if (vect_a[i] != x) + break; + vect_a[i] = x; + } + return ret; +} diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_115-pr113750.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_115-pr113750.c new file mode 100644 index 0000000000000000000000000000000000000000..502686d308e298cd84e9e3b74d7b4ad1979602a9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_115-pr113750.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-add-options vect_early_break } */ +/* { dg-require-effective-target vect_early_break } */ +/* { dg-require-effective-target vect_int } */ + +/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */ + +#ifndef N +#define N 800 +#endif +unsigned vect_a[N]; +unsigned vect_b[N]; + +unsigned test4(unsigned x) +{ + unsigned ret = 0; + for (int i = 0; i < N; i++) + { +foo: + vect_b[i] = x + i; + if (vect_a[i] != x) + break; + vect_a[i] = x; + } + return ret; +} diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_116-pr113750.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_116-pr113750.c new file mode 100644 index 0000000000000000000000000000000000000000..4e02158aa351c8e1a5edf6cc7bcab0b5eaa06795 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_116-pr113750.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-add-options vect_early_break } */ +/* { dg-require-effective-target vect_early_break } */ +/* { dg-require-effective-target vect_int } */ + +/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */ + +#ifndef N +#define N 800 +#endif +unsigned vect_a[N]; +unsigned vect_b[N]; + +unsigned test4(unsigned x) +{ + unsigned ret = 0; + for (int i = 0; i < N; i++) + { + vect_b[i] = x + i; + if (vect_a[i] != x) +foo: + break; + vect_a[i] = x; + } + return ret; +} diff --git a/gcc/tree-vect-data-refs.cc b/gcc/tree-vect-data-refs.cc index 53fdfc25d7dc2deb7788176252697d2e455555fc..109d4ce5192f304d31f36fd6dfe32dd1f4bcbe82 100644 --- a/gcc/tree-vect-data-refs.cc +++ b/gcc/tree-vect-data-refs.cc @@ -819,6 +819,18 @@ vect_analyze_early_break_dependences (loop_vec_info loop_vinfo) trapped already during loop form analysis. */ gcc_assert (dest_bb->loop_father == loop); + /* Check that the destination block we picked has only one pred. To relax this we + have to take special care when moving the statements. We don't currently support + such control flow however this check is there to simplify how we handle + labels that may be present anywhere in the IL. This check is to ensure that the + labels aren't significant for the CFG. */ + if (!single_pred (dest_bb)) + return opt_result::failure_at (vect_location, + "chosen loop exit block (BB %d) does not have a " + "single predecessor which is currently not " + "supported for early break vectorization.\n", + dest_bb->index); + LOOP_VINFO_EARLY_BRK_DEST_BB (loop_vinfo) = dest_bb; if (!LOOP_VINFO_EARLY_BRK_VUSES (loop_vinfo).is_empty ()) diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index e2587315020a35a7d4ebd3e7a9842caa36bb5d3c..e85b1fd20eda815d5615c1934c2ac5afcaf53f67 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -11786,7 +11786,7 @@ move_early_exit_stmts (loop_vec_info loop_vinfo) /* Move all stmts that need moving. */ basic_block dest_bb = LOOP_VINFO_EARLY_BRK_DEST_BB (loop_vinfo); - gimple_stmt_iterator dest_gsi = gsi_start_bb (dest_bb); + gimple_stmt_iterator dest_gsi = gsi_after_labels (dest_bb); for (gimple *stmt : LOOP_VINFO_EARLY_BRK_STORES (loop_vinfo)) { --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_112-pr113750.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-add-options vect_early_break } */ +/* { dg-require-effective-target vect_early_break } */ +/* { dg-require-effective-target vect_int } */ + +/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */ + +#ifndef N +#define N 800 +#endif +unsigned vect_a[N]; +unsigned vect_b[N]; + +unsigned test4(unsigned x) +{ + unsigned ret = 0; + for (int i = 0; i < N; i++) + { + vect_b[i] = x + i; + if (vect_a[i] != x) + break; +foo: + vect_a[i] = x; + } + return ret; +} diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_113-pr113750.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_113-pr113750.c new file mode 100644 index 0000000000000000000000000000000000000000..ba85780a46b1378aaec238ff9eb5f906be9a44dd --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_113-pr113750.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-add-options vect_early_break } */ +/* { dg-require-effective-target vect_early_break } */ +/* { dg-require-effective-target vect_int } */ + +/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */ + +#ifndef N +#define N 800 +#endif +unsigned vect_a[N]; +unsigned vect_b[N]; + +unsigned test4(unsigned x) +{ + unsigned ret = 0; + for (int i = 0; i < N; i++) + { + vect_b[i] = x + i; + if (vect_a[i] != x) + break; + vect_a[i] = x; +foo: + } + return ret; +} diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_114-pr113750.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_114-pr113750.c new file mode 100644 index 0000000000000000000000000000000000000000..37af2998688f5d60e2cdb372ab43afcaa52a3146 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_114-pr113750.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-add-options vect_early_break } */ +/* { dg-require-effective-target vect_early_break } */ +/* { dg-require-effective-target vect_int } */ + +/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */ + +#ifndef N +#define N 800 +#endif +unsigned vect_a[N]; +unsigned vect_b[N]; + +unsigned test4(unsigned x) +{ + unsigned ret = 0; + for (int i = 0; i < N; i++) + { + vect_b[i] = x + i; +foo: + if (vect_a[i] != x) + break; + vect_a[i] = x; + } + return ret; +} diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_115-pr113750.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_115-pr113750.c new file mode 100644 index 0000000000000000000000000000000000000000..502686d308e298cd84e9e3b74d7b4ad1979602a9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_115-pr113750.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-add-options vect_early_break } */ +/* { dg-require-effective-target vect_early_break } */ +/* { dg-require-effective-target vect_int } */ + +/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */ + +#ifndef N +#define N 800 +#endif +unsigned vect_a[N]; +unsigned vect_b[N]; + +unsigned test4(unsigned x) +{ + unsigned ret = 0; + for (int i = 0; i < N; i++) + { +foo: + vect_b[i] = x + i; + if (vect_a[i] != x) + break; + vect_a[i] = x; + } + return ret; +} diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_116-pr113750.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_116-pr113750.c new file mode 100644 index 0000000000000000000000000000000000000000..4e02158aa351c8e1a5edf6cc7bcab0b5eaa06795 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_116-pr113750.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-add-options vect_early_break } */ +/* { dg-require-effective-target vect_early_break } */ +/* { dg-require-effective-target vect_int } */ + +/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */ + +#ifndef N +#define N 800 +#endif +unsigned vect_a[N]; +unsigned vect_b[N]; + +unsigned test4(unsigned x) +{ + unsigned ret = 0; + for (int i = 0; i < N; i++) + { + vect_b[i] = x + i; + if (vect_a[i] != x) +foo: + break; + vect_a[i] = x; + } + return ret; +} diff --git a/gcc/tree-vect-data-refs.cc b/gcc/tree-vect-data-refs.cc index 53fdfc25d7dc2deb7788176252697d2e455555fc..109d4ce5192f304d31f36fd6dfe32dd1f4bcbe82 100644 --- a/gcc/tree-vect-data-refs.cc +++ b/gcc/tree-vect-data-refs.cc @@ -819,6 +819,18 @@ vect_analyze_early_break_dependences (loop_vec_info loop_vinfo) trapped already during loop form analysis. */ gcc_assert (dest_bb->loop_father == loop); + /* Check that the destination block we picked has only one pred. To relax this we + have to take special care when moving the statements. We don't currently support + such control flow however this check is there to simplify how we handle + labels that may be present anywhere in the IL. This check is to ensure that the + labels aren't significant for the CFG. */ + if (!single_pred (dest_bb)) + return opt_result::failure_at (vect_location, + "chosen loop exit block (BB %d) does not have a " + "single predecessor which is currently not " + "supported for early break vectorization.\n", + dest_bb->index); + LOOP_VINFO_EARLY_BRK_DEST_BB (loop_vinfo) = dest_bb; if (!LOOP_VINFO_EARLY_BRK_VUSES (loop_vinfo).is_empty ()) diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index e2587315020a35a7d4ebd3e7a9842caa36bb5d3c..e85b1fd20eda815d5615c1934c2ac5afcaf53f67 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -11786,7 +11786,7 @@ move_early_exit_stmts (loop_vec_info loop_vinfo) /* Move all stmts that need moving. */ basic_block dest_bb = LOOP_VINFO_EARLY_BRK_DEST_BB (loop_vinfo); - gimple_stmt_iterator dest_gsi = gsi_start_bb (dest_bb); + gimple_stmt_iterator dest_gsi = gsi_after_labels (dest_bb); for (gimple *stmt : LOOP_VINFO_EARLY_BRK_STORES (loop_vinfo)) {