From patchwork Fri Dec 29 14:44:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamar Christina X-Patchwork-Id: 1881094 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=rIPfGI0C; 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=rIPfGI0C; 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 4T1p811RrZz1ySy for ; Sat, 30 Dec 2023 01:45:21 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2BF3B3858434 for ; Fri, 29 Dec 2023 14:45:19 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2040.outbound.protection.outlook.com [40.107.105.40]) by sourceware.org (Postfix) with ESMTPS id E148C385840C for ; Fri, 29 Dec 2023 14:44:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E148C385840C 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 E148C385840C Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.105.40 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1703861067; cv=pass; b=ohINvRFgUwGoBn6GCUSecgwj8CSHxqaJzMsL/+MQJ26htkjnljDf9jCC9Ya65zUtoi3pGUCiiRBZ9Gcp71vrHWF/gsr81P1iK8/axpMrpj0VqNtYSGXDfi35MVNMOw12sQoNZ9iZ+fNks7ek+BVwoxkVoqHSY2epYq1H9jy16jw= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1703861067; c=relaxed/simple; bh=kg2UYsfqjC0XdrcoDAIJC1lpTjkcWV6aCkMtkGju/Og=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:Message-ID: MIME-Version; b=aQX6xMvT68lKwxmVS21mrbEoSMJ0VteOYVIcwz9srzjWo1QN6KeS4DvcPCudUQmn9SDgwQLz6CisAfMC9ckCj2UcvXJgvjPuLjimRxSXXyrbsTlWxNJFzxmyumRoLwmocOyXeLwKZhfAQankp0c0mQ5ZG7xbdGK4+y1F1LSYcmk= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=cYEAhghsbvzmB3kTpHvocPIDBlFneYCnsezwsDmqFc4SMxQJvsuRT/3lFcA2pgX8+n77SZRJg4TNRJcayyOg8+/2qC5cTpZ1fZzboo6gWbmZ5a+cLxWBy8635mSRoGfbHWDQL587oTN/gfMPPY0SkEaoOHOLup7OMTmOzC2r9sx7vKwOMHwZOunbw+a41jANzYCJg/HsupHcDUhuUbCmRPT6KATcKvuGUQjCDrkkj/Im9FJbvuOGMGb7ECJYeU8rkbMhoSmMsSBibV9dPEK2283k73z+KZBl6DdFecOiqchnqLbHwbdToSlFubUFxqnVlejUUkoLQjHtuwb7Qag3Xg== 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=nSiKabBdT0q4s+d30QExZrsQB2N87ESHZKFgqRoEBhk=; b=Bu+qpLdCwVBshp/ZfoGh61Wf5AvUBUnQaUWItd14JLk7vx8wIc+kRkwvDP9SYwyvXuob5EJJf7mcXMRksYbstRQBjKQK6kcKeW2qhmglJKOkuCO1cvY2fTJ/QWBV3Jd1jrgOaWR+Qtwc2MwR77sIn+Pk2dN3lZI3Y9jcGOIElBWJhfZixGaUp3WyUCOiJ7XaNrPd6LMJoxWTOZ+rpMIjnxvitfBfWbsApTWuY1B0ntOF7CMsqMyWEoQKw5TjcnUTG4N2/tei2QiWGiEAfaxIJYTDwfAbPBtxJdOFFHz3B5sqPl9LeJ1NpPFEW1lABwuz3F1Jchjk29q+r2QFd2F0xw== 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=nSiKabBdT0q4s+d30QExZrsQB2N87ESHZKFgqRoEBhk=; b=rIPfGI0Ce5d3tr/8b/tM08TtqLAVo00nT1Q1GbDT9mk+Zk+ax/zNAk2HqXo98BB93uz9uu8KMJ+7fsoMpcpIl+qO66xQiKtDpXgbDemEBLfls6DmMJS9ypfzMJ1o5axmQ7vtdxAJad4GR14/MI0lPjG9DUqw70MSGu8sCjV/eG8= Received: from AM5PR1001CA0017.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:206:2::30) by VI1PR08MB10244.eurprd08.prod.outlook.com (2603:10a6:800:1bd::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.20; Fri, 29 Dec 2023 14:44:16 +0000 Received: from AMS0EPF000001B2.eurprd05.prod.outlook.com (2603:10a6:206:2:cafe::63) by AM5PR1001CA0017.outlook.office365.com (2603:10a6:206:2::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.20 via Frontend Transport; Fri, 29 Dec 2023 14:44:16 +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 AMS0EPF000001B2.mail.protection.outlook.com (10.167.16.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.9 via Frontend Transport; Fri, 29 Dec 2023 14:44:16 +0000 Received: ("Tessian outbound 20615a7e7970:v228"); Fri, 29 Dec 2023 14:44:16 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 8c748a6da3f207d5 X-CR-MTA-TID: 64aa7808 Received: from 017ba607da13.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 39E0D900-5A1E-4C3B-AC5A-6FFE91445661.1; Fri, 29 Dec 2023 14:44:09 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 017ba607da13.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 29 Dec 2023 14:44:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XFt/yCr4myo2fAn+9QNJRz0iqy0ZUpsHvtYCbCHFYFPGWVdDTFdcCgt0knsuIFd0BIJojoHqBCE9+0p3cwBq62aTkDjUCUcqRHmqC60s+91r/sW1gXCMjZdpZ7IR6GzW/nOe+de3hQQqsgHKpCoF45Oc4zHhvMHjj2HiHbfi49A0J1AGYimrMr6fgK8pmZ+smrUnWOvtrmotYKpZr1tcqmOS3dxsg0ODbQJdRYSeyUb7FjFdEfkobsAXbsceN7hdI2FEGaAgvlKDI7dBP6kF1uCT69VHlLq4TMSOxW9MFpF65G9xpN8uzjYBdx+rFQ8CkELrMwoInkbxrDNnPI12dQ== 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=nSiKabBdT0q4s+d30QExZrsQB2N87ESHZKFgqRoEBhk=; b=V7HAaJmdDmp9Lqo7QuX9kuABUOXG29OChzgXBcQoH3qvz3PVf5kcWTsQUjBv32gjqpIVZmQf2rNkDTS/tYLIDIcdLynJsH06nnS6Lo4h1Jm8/lnjAwqKp68Vj/73znY9gQ/5tpXigJAwUXxepnbID4ynheHDnvBPLBNJkSiS+nfJeFU6wIVfmiUxHm1i65MksVXLomE5NKSbv+xLCiwfmVzqnU2jUGRI0ByN9Z/VGl6d4MVLuOzrXNk8ywHXUggzwik7d9zzNLBcwO6g/OJ6nYsKK8U1yc3BLapmqDYRufwjnnLlod+mLf9VdlMjtb23iOSG7nASjUgQI3cfuPSKJg== 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=nSiKabBdT0q4s+d30QExZrsQB2N87ESHZKFgqRoEBhk=; b=rIPfGI0Ce5d3tr/8b/tM08TtqLAVo00nT1Q1GbDT9mk+Zk+ax/zNAk2HqXo98BB93uz9uu8KMJ+7fsoMpcpIl+qO66xQiKtDpXgbDemEBLfls6DmMJS9ypfzMJ1o5axmQ7vtdxAJad4GR14/MI0lPjG9DUqw70MSGu8sCjV/eG8= 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 PAXPR08MB6653.eurprd08.prod.outlook.com (2603:10a6:102:15f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.21; Fri, 29 Dec 2023 14:44:06 +0000 Received: from VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::9679:2ab0:99c6:54a3]) by VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::9679:2ab0:99c6:54a3%6]) with mapi id 15.20.7135.019; Fri, 29 Dec 2023 14:44:06 +0000 Date: Fri, 29 Dec 2023 14:44:04 +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 dominators updates when peeling with multiple exits [PR113144] Message-ID: Content-Disposition: inline X-ClientProxiedBy: LO2P265CA0075.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:8::15) To VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB5325:EE_|PAXPR08MB6653:EE_|AMS0EPF000001B2:EE_|VI1PR08MB10244:EE_ X-MS-Office365-Filtering-Correlation-Id: 08e06b06-ca17-45e7-18cf-08dc087ca1f8 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: qpXVU4OeOEdnNek0afGu0Nz1qsNY6UfzUDjS0bWfziJiJPCqWxEzqsNSanCud+LBLv9JRz0VZWwGMDn1bIMfKln6V31jyIEuoN3zB9zEd1O/tjMBU22xfEoZa+nt1u3HD/fpSxZBkXbEOWxGb1pQhi3IPm4I+0EGYGhWNPmBnGvlqByb4svesvK2G1sjLMM6f6RVRk9fuX0Xrg35lY5HWtMt9cSXYL/U2cUjhQ0KtXupCro7VhucHJcYwqEHPfqKOwG8plKRKXXNW9fJWI0vQjZp2JOgvLDncWcCmyBJiUqzOTkAVO0SJa379nrwr88nUAFo7BVYkz0W6FOslRG1/qoGPZx5t1i/1FLiKrzAid+m0dZcs0JxIGzRI4ZIjuL31os5peVAcevWTkTyiTRKawN3uwkvpaBq8w4QT/VH+tFgR79ucko8jhThG7i4qMpFwBSDKlLHq0AmXl/nUzHOYJfvWwTfBlgo44C9qDwqsYn/e8v3D7eS8Aln9BN2dI5PWjDJLiqwkx5NRRm6Um2XES9G9HE/VqIpCQxT3V0yj4fwiJ6NnNX9HFD9ngNj3jnzdMhZxmDP0cRXTWCnLvL8oD2QalewFwuAJ0SSEw/oBPiy0pty/i50lRZIKh7/i9kJ 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)(376002)(366004)(346002)(136003)(396003)(39860400002)(230922051799003)(1800799012)(451199024)(186009)(64100799003)(44832011)(5660300002)(235185007)(15650500001)(8676002)(8936002)(4326008)(2906002)(478600001)(6486002)(44144004)(6506007)(6512007)(33964004)(6916009)(66476007)(66556008)(66946007)(316002)(41300700001)(86362001)(2616005)(26005)(36756003)(38100700002)(83380400001)(4743002)(84970400001)(4216001)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6653 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: AMS0EPF000001B2.eurprd05.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 80ee0766-b836-4d89-68ec-08dc087c9bf6 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aAmAl07y76Xsw4ZZLKOsG8gueYnhARxy8KZgrMZsdJM6SBARroHGWYGzZDziigD4FbykNUKkNKtdmL/5x+VU9rEP8nZsYTlxIZ97rY30z3iq5wQgSvCXfTUbpsP4+yC6AWNnaEen923yYcZ2+C0/vgzLzr4S7OrmmZ7eww+BlB7TJ7P9Uxhdg9RQKE09zFI/aDdPTo1K5FL+YYZq6uJAHyPEbO4KPQ3tYRZn3HRodyN9jaca+OgcEs56shd6aAUxb3/EdFKXa0xR1r5XgLzLohbjkoblopNNRkcCtdjiBeca5Ej/RrAwEsmpxSZXeztlgmY6cRerGs32LNCQ99H732D3uhN9qFsd3YMseAD1CqLwK/lMJ2Et+6Wyloyp5Rck5oCktOzJe26LcMbgzsomMsmGeN67IDhvvm/zA8Zcj3E9359BMJanl+SZ54317Eixk6c9maJXLcZ2SkWKcc5N8iACFwUQYTGh3AfySUh6K4V5mTAiRXhtDFEuuV8GWi/cz94a8TQZpeCBjOgT0FPnoE4Pvox2Vft3jWg8O+H7/u4rmxbB1j36CtMdK1eaUgcU/YP7tDEy54PkjVkmt8OzutBxVYjXPkkTnzcDy1PUy1HhHETrtWPTSxe7n9mGq4c1EmrhGQTiB8sZGSOxyt0nobKDAbR7tbnGxcJEHRO3PWeK1tZmvkN2cflwr3jDzCb2ztgftYtG5WrQuUbFZGpT55j+shr2eR84QVS3ZNaeLWMwAR1qW2O6de2Rf3I0WEPe 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)(136003)(39850400004)(376002)(346002)(230922051799003)(82310400011)(1800799012)(186009)(64100799003)(451199024)(46966006)(36840700001)(47076005)(2906002)(70206006)(26005)(6486002)(2616005)(33964004)(107886003)(6512007)(44144004)(70586007)(82740400003)(6916009)(86362001)(6506007)(36860700001)(84970400001)(36756003)(40480700001)(356005)(81166007)(4743002)(41300700001)(5660300002)(336012)(8676002)(316002)(478600001)(4326008)(15650500001)(235185007)(83380400001)(8936002)(44832011)(4216001)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Dec 2023 14:44:16.5344 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 08e06b06-ca17-45e7-18cf-08dc087ca1f8 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: AMS0EPF000001B2.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB10244 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Hi All, Only trying to update certain dominators doesn't seem to work very well because as the loop gets versioned, peeled, or skip_vector then we end up with very complicated control flow. This means that the final merge blocks for the loop exit are not easy to find or update. Instead of trying to pick which exits to update, this changes it to update all the blocks reachable by the new exits. This is because they'll contain common blocks with e.g. the versioned loop. It's these blocks that need an update most of the time. Bootstrapped Regtested on aarch64-none-linux-gnu and no issues. Ok for master? Thanks, Tamar gcc/ChangeLog: PR middle-end/113144 * tree-vect-loop-manip.cc (slpeel_tree_duplicate_loop_to_edge_cfg): Update all dominators reachable from exit. gcc/testsuite/ChangeLog: PR middle-end/113144 * gcc.dg/vect/vect-early-break_94-pr113144.c: New test. --- inline copy of patch -- diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_94-pr113144.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_94-pr113144.c new file mode 100644 index 0000000000000000000000000000000000000000..903fe7be6621e81db6f29441e4309fa213d027c5 --- diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_94-pr113144.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_94-pr113144.c new file mode 100644 index 0000000000000000000000000000000000000000..903fe7be6621e81db6f29441e4309fa213d027c5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_94-pr113144.c @@ -0,0 +1,41 @@ +/* { 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" } } */ + +long tar_atol256_max, tar_atol256_size, tar_atosl_min; +char tar_atol256_s; +void __errno_location(); + + +inline static long tar_atol256(long min) { + char c; + int sign; + c = tar_atol256_s; + sign = c; + while (tar_atol256_size) { + if (c != sign) + return sign ? min : tar_atol256_max; + c = tar_atol256_size--; + } + if ((c & 128) != (sign & 128)) + return sign ? min : tar_atol256_max; + return 0; +} + +inline static long tar_atol(long min) { + return tar_atol256(min); +} + +long tar_atosl() { + long n = tar_atol(-1); + if (tar_atosl_min) { + __errno_location(); + return 0; + } + if (n > 0) + return 0; + return n; +} diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc index 1066ea17c5674e03412b3dcd8a62ddf4dd54cf31..3810983a80c8b989be9fd9a9993642069fd39b99 100644 --- a/gcc/tree-vect-loop-manip.cc +++ b/gcc/tree-vect-loop-manip.cc @@ -1716,8 +1716,6 @@ slpeel_tree_duplicate_loop_to_edge_cfg (class loop *loop, edge loop_exit, /* Now link the alternative exits. */ if (multiple_exits_p) { - set_immediate_dominator (CDI_DOMINATORS, new_preheader, - main_loop_exit_block); for (auto gsi_from = gsi_start_phis (loop->header), gsi_to = gsi_start_phis (new_preheader); !gsi_end_p (gsi_from) && !gsi_end_p (gsi_to); @@ -1751,12 +1749,26 @@ slpeel_tree_duplicate_loop_to_edge_cfg (class loop *loop, edge loop_exit, /* Finally after wiring the new epilogue we need to update its main exit to the original function exit we recorded. Other exits are already - correct. */ + correct. Because of versioning, skip vectors and others we must update + the dominators of every node reachable by the new exits. */ if (multiple_exits_p) { update_loop = new_loop; - for (edge e : get_loop_exit_edges (loop)) - doms.safe_push (e->dest); + hash_set visited; + auto_vec workset; + edge ev; + edge_iterator ei; + workset.safe_splice (get_loop_exit_edges (loop)); + while (!workset.is_empty ()) + { + auto bb = workset.pop ()->dest; + if (visited.add (bb)) + continue; + doms.safe_push (bb); + FOR_EACH_EDGE (ev, ei, bb->succs) + workset.safe_push (ev); + } + visited.empty (); doms.safe_push (exit_dest); /* Likely a fall-through edge, so update if needed. */ --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_94-pr113144.c @@ -0,0 +1,41 @@ +/* { 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" } } */ + +long tar_atol256_max, tar_atol256_size, tar_atosl_min; +char tar_atol256_s; +void __errno_location(); + + +inline static long tar_atol256(long min) { + char c; + int sign; + c = tar_atol256_s; + sign = c; + while (tar_atol256_size) { + if (c != sign) + return sign ? min : tar_atol256_max; + c = tar_atol256_size--; + } + if ((c & 128) != (sign & 128)) + return sign ? min : tar_atol256_max; + return 0; +} + +inline static long tar_atol(long min) { + return tar_atol256(min); +} + +long tar_atosl() { + long n = tar_atol(-1); + if (tar_atosl_min) { + __errno_location(); + return 0; + } + if (n > 0) + return 0; + return n; +} diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc index 1066ea17c5674e03412b3dcd8a62ddf4dd54cf31..3810983a80c8b989be9fd9a9993642069fd39b99 100644 --- a/gcc/tree-vect-loop-manip.cc +++ b/gcc/tree-vect-loop-manip.cc @@ -1716,8 +1716,6 @@ slpeel_tree_duplicate_loop_to_edge_cfg (class loop *loop, edge loop_exit, /* Now link the alternative exits. */ if (multiple_exits_p) { - set_immediate_dominator (CDI_DOMINATORS, new_preheader, - main_loop_exit_block); for (auto gsi_from = gsi_start_phis (loop->header), gsi_to = gsi_start_phis (new_preheader); !gsi_end_p (gsi_from) && !gsi_end_p (gsi_to); @@ -1751,12 +1749,26 @@ slpeel_tree_duplicate_loop_to_edge_cfg (class loop *loop, edge loop_exit, /* Finally after wiring the new epilogue we need to update its main exit to the original function exit we recorded. Other exits are already - correct. */ + correct. Because of versioning, skip vectors and others we must update + the dominators of every node reachable by the new exits. */ if (multiple_exits_p) { update_loop = new_loop; - for (edge e : get_loop_exit_edges (loop)) - doms.safe_push (e->dest); + hash_set visited; + auto_vec workset; + edge ev; + edge_iterator ei; + workset.safe_splice (get_loop_exit_edges (loop)); + while (!workset.is_empty ()) + { + auto bb = workset.pop ()->dest; + if (visited.add (bb)) + continue; + doms.safe_push (bb); + FOR_EACH_EDGE (ev, ei, bb->succs) + workset.safe_push (ev); + } + visited.empty (); doms.safe_push (exit_dest); /* Likely a fall-through edge, so update if needed. */