From patchwork Tue Feb 23 19:17:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamar Christina X-Patchwork-Id: 1443612 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=ihrriNFo; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DlTNR5drXz9sCD for ; Wed, 24 Feb 2021 06:18:13 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 213383861838; Tue, 23 Feb 2021 19:18:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 213383861838 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1614107891; bh=cS3UGVXPuM1bCSG4LBG4zCvXUHWIQYCSU6IRQLWHVjk=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=ihrriNFoZ2c+qXB9KbEgDkezpasSqzHDSCJFwrK/P0/TMNV3Ro+MDvIRJb6yVWjeh VZRPH8jYesuY7ok+c5+RSSfNwkJ+ND4ALB6RtkkqOyy+Klkf90DR6OxnTqB3QpeoQn BwEeyuyESJ0J4lYn6fB2PAxE6iuMs8Dxt9HvNWy0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00051.outbound.protection.outlook.com [40.107.0.51]) by sourceware.org (Postfix) with ESMTPS id 2F4033861838 for ; Tue, 23 Feb 2021 19:18:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2F4033861838 Received: from AM6PR08CA0011.eurprd08.prod.outlook.com (2603:10a6:20b:b2::23) by DB8PR08MB5500.eurprd08.prod.outlook.com (2603:10a6:10:11e::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.29; Tue, 23 Feb 2021 19:18:03 +0000 Received: from AM5EUR03FT026.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:b2:cafe::8a) by AM6PR08CA0011.outlook.office365.com (2603:10a6:20b:b2::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Tue, 23 Feb 2021 19:18:03 +0000 X-MS-Exchange-Authentication-Results: spf=temperror (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; gcc.gnu.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;gcc.gnu.org; dmarc=temperror action=none header.from=arm.com; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT026.mail.protection.outlook.com (10.152.16.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Tue, 23 Feb 2021 19:18:02 +0000 Received: ("Tessian outbound 6af2d67f452e:v71"); Tue, 23 Feb 2021 19:18:01 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: c8f944eb8c1f6297 X-CR-MTA-TID: 64aa7808 Received: from 08e356f7dd94.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 79980E02-7A4F-468F-93E4-874401F6A537.1; Tue, 23 Feb 2021 19:17:54 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 08e356f7dd94.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 23 Feb 2021 19:17:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n/U9pdHnci+Eh5u1b1eSa4ANaAl2ccOGmT9a+kK1GHEl6Hdfu/4nB4bzWJcynJeX//KKEOit9ElytAiJJ6nhjwHFxpF3DChNYtzalw02Cize8zxkSv4jgJMQYMNlfbhuE8XIdZ7Eo4MTI2NgNXxYPRJgdjITutpOjfxvAdXx03h34FZS9qtGM5Ey1/Q8WlmRP4LUY05380X0DNtNC1X5Gh3WRy2uY/2qwY8CPspLZEzgjrDaQTD++8k0u4ZxUgVTW84OzoUlTz3KicOACmc3Jmyz+lihwqMAlIY8QrnmoI5un8ATAndIoR7wKJPeiGY1ZjmFh7QfwoQrenblgT/+4Q== 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-SenderADCheck; bh=cS3UGVXPuM1bCSG4LBG4zCvXUHWIQYCSU6IRQLWHVjk=; b=n8P0JHfEWa7zTNPjU57OdXtSU3jnOOsYtMMSJESrBVbu1h/Vn624gBcjMOCVjCTcnMrepQRI51cACSv6GnW/L5WOj0aOiRhtjRbhaDDqad2O2tRU8l6Tavf/9gg4KdeIexivJYo6Fbxq+M4nPI4YFSHLV8FKQ4AMUqptem0xayoZflenHveXYnZER+9PC3JlsaiRcbuXheKBjPdKmGY2TtkgeQMB9jqqioRCn/FdYVR0+6pRrlrQbx3GQGG9CqiCfjGmWSsP80jhK0ZH6BkaPIawew6YWLH0YXnEXwoVIBELilh4VSUSfzAMcF2NynjMzSTQRkwOpeg93hUgWNwxfw== 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 Authentication-Results-Original: gcc.gnu.org; dkim=none (message not signed) header.d=none;gcc.gnu.org; dmarc=none action=none header.from=arm.com; Received: from VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) by VE1PR08MB5008.eurprd08.prod.outlook.com (2603:10a6:803:116::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.29; Tue, 23 Feb 2021 19:17:47 +0000 Received: from VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::ed1e:9499:4501:2118]) by VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::ed1e:9499:4501:2118%8]) with mapi id 15.20.3868.033; Tue, 23 Feb 2021 19:17:46 +0000 Date: Tue, 23 Feb 2021 19:17:39 +0000 To: gcc-patches@gcc.gnu.org Subject: [PATCH]middle-end slp: fix accidental resource re-use of slp_tree (PR99220) Message-ID: Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-Originating-IP: [217.140.106.53] X-ClientProxiedBy: SN7PR04CA0177.namprd04.prod.outlook.com (2603:10b6:806:125::32) To VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from arm.com (217.140.106.53) by SN7PR04CA0177.namprd04.prod.outlook.com (2603:10b6:806:125::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.33 via Frontend Transport; Tue, 23 Feb 2021 19:17:45 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c7a91a96-93d0-4a4c-ddec-08d8d82fbd1b X-MS-TrafficTypeDiagnostic: VE1PR08MB5008:|DB8PR08MB5500: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8273;OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: UWu2JH+4p1wDoENCW01gWBjQODpx6N8uYcI8H6gEbqnu5AazjPU0yDOl6B8ftRr29beDlOZX3PX+r0pQfHFpSHfnKNEBBzY53gFSozFRBEgJdYXiunvkZjT/Uhwq3IU2PRaTdVQJBCQNnRJpQvs6jhI7idiR9BX24h1NpQLMi4dF1OXUttfthFk5Vg0/8TT1NatAgP6dUCFAhOowTKHAJMHjQu2AB/vdtx7TabUSxkNlkLhKkN3glsOCZVHycyGjIQFlj1J7hMgXz82EA2JEc1M8cMuVAaw9ZtXN6bD/i+YPkC40uJ/Aj/YxBbHud4FJlRBkeyOF77LgiqtzsBeTo8McK5dwJbGx1c8/DDiUro5HLjzUVLMTtZ+Jzxk6zXp3+dizb9eskf2v05q32jUOMSwTSZfpPmyI5HEsQhmzwlvuAKQdYrjZckSOvLDdeSU5HMHwfSBvspapCcOz6NVOvlWu7W2pjP4yarB4SybaL0wK4KPv+/76IWyBabc7W3DUZ2DCMRRKTQI6mY3wDe5lWRB6nmUAp9lRR3LLXWWKm/nSj3sEqcoCZVJOzcpouf2+6M/GR4AhJPBdDlUlbcTTSQ== 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:(4636009)(136003)(346002)(39860400002)(366004)(396003)(376002)(2616005)(52116002)(26005)(8936002)(8676002)(316002)(55016002)(2906002)(4326008)(36756003)(86362001)(186003)(66616009)(4743002)(235185007)(5660300002)(66946007)(66476007)(8886007)(6916009)(66556008)(6666004)(478600001)(956004)(7696005)(33964004)(16526019)(44832011)(44144004)(4216001)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?q?OSmmP3E5JdBJipX6KHzyzNQlY07zT6?= =?utf-8?q?XpWXJHgGx0+0oiAsYrxwm0B0kSkHYBvWcgpt7avbac+Z3mMH9gz3TqLJGPIkGkqRR?= =?utf-8?q?I3CMUk+ftMdgA+V9swbphWAH60T1UThSX7SYKK6sPagIP9QYbMKKCLT3ImqpHTeXq?= =?utf-8?q?d39VAj8N5oBO/Ey4BS9lL9uIcsEicLGpYdMMW19n2I2v/ZnTr9rqoD/kx2uObQqdd?= =?utf-8?q?gsoEexwSrcrGjArzz+U1reTpnDlcdNDEE1kSmuG70ovKZ9bMpT4YJXazV8sYRCbfd?= =?utf-8?q?T5qyEgq4F8s9jPKI3aKzpy8AnRI9S7WyXGfRwRk0QrWcOixJMtibdo7lKS+Ne9DlO?= =?utf-8?q?zP49IjaVYoDL8IjIsUkE7OlUWQv0mDQD6WushJdYmnww/wXK4ppnWyHCMBSmaRSl1?= =?utf-8?q?/82xz748XeTa4UTuKCuQ+Wv4rXTxRB9Qopc2FtZfKu+Wi1aF2e8Wvv3MFMY1k5cHG?= =?utf-8?q?iXmglagTe4cR1rzAL6QU9kBXVwcjqRDI6+lK7Kowmh4+BB2Oe380jV89HCeHSkl7s?= =?utf-8?q?q3xgHAMmjea1OuySm2CcOpnhaFVjIWhA64nMd2nCV7nJoU54wyn+xTHMqM2ZvO7Of?= =?utf-8?q?tkbNAt8uYn9iWYgb+/Re/0JX75zDzDy01epC7S5G383dhG8666+L/rciRd8lWzTXE?= =?utf-8?q?ifuEZBY5Y7sUf6dLvCrdbTGrFS+sHc0QSWSK5IWywGfE/UqACN7QrWlnHv4hKSZnw?= =?utf-8?q?TNEg310JI/VmYmf1UkyvfApnzB5YXHoi1ziF/FMNGabpQ0a77qEshEczIZ2e9k+bR?= =?utf-8?q?XH57FkKqualQF3FzYU0q2OfcPRHJ61wflTpsvabotk6n/MTx0iiiylg17Skb4Ze2j?= =?utf-8?q?jhfIJh6QHlYvpoCb+1ozYi/qxM15UVamagiqHvAyQYbYorFoaNdFnyZuwhS5HF4re?= =?utf-8?q?b1KMfRcRoYoWkCbisoq2SYaM2SBm6AieqIvNqrndItnoSTSLSYfTG0DX/lqz8bFhz?= =?utf-8?q?CI1InrTSIJSp7Xf1QCA9f2C569ZXwwvz9M8Xv+vTvdfJbrP/gyXTVfZYMfw0W2w7+?= =?utf-8?q?lAyMsL10Q6B6SvgvzaO3/RS2oEbO69AvNyvZHFolzmLWGDfPZDM6tSN1bTrVOnCVW?= =?utf-8?q?HT/ooKQ5nMjOze11ahqd9g+y3+yv3HkOzb5/Ksvc7Wqy6vcfvOhgA0Ei+g9Fjkuk0?= =?utf-8?q?S/1rc54WSnQR5K8ExhsWxIac161reBEy394pfsjgdnNqzcrescgMMRpjFY2KfvCuc?= =?utf-8?q?jzawoqhG2M/vVuj4rx51FKzHG8zOoezmQUWom+rK+V43hKFCFaUZg8BK+L2eyod3c?= =?utf-8?q?+8/tBK1cU2/BQA?= X-MS-Exchange-Transport-Forked: True X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5008 Original-Authentication-Results: gcc.gnu.org; dkim=none (message not signed) header.d=none;gcc.gnu.org; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT026.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 6b449f52-ed44-4617-80d6-08d8d82fb3dc X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CERmaHP6L1qX2IO0dYSskvy4m0RUo7zSTLDxi9zQQwP+AR9xKvqXnIVwsyc8qE2QR7f7LcJZkz0oxsJO295RwDEMobwRFGQyQcy5RzRTdmD0RU3ZkNX9wohvi7vXYJkP1Mf+WFq26W3lnridiXnqvigKsJyZFzRKFTw8HSBvPpFF65X7AaMA6Fu901Yup4goetWggqat8QynBV3jsz/uhPHsPRBpNMvUoZH9M6ac7d1F6ueRPQXN+To7XU0zxmjCPJJVch8iac9i9dTX2DluEgQBzXo+kxEBl9beizTiS8ujkVA8Kr3JbzBI4tqZGKY2pRsZpb7HRrrrpLBEG1aCg1PZsdxaovSfqno6EpYdAdrLrBjtNGlNxjcoT2pkWkxhBCTUWk9mlfYUa5e/tR9DNuac3Tx/9EqlOKux2P/beNUfQ3i1suN9gUELhm1/9TuJ4VZ+oV56ffcjk4fheiytnpxMmEKHzrh03RnxWc0yxaSfieORodMe7iZc9Oxq+yFlrEXIdNSzXA/wBxELdHkSRjSbAsNhx9U4Wc1Imkb3OzKm6BzpTPQcxruj08+Eodf2dmERpaFt9ioak6r/SOmKZP1jRxHhOqzXsdLtUY8K8hCJdSm5LijeQ5//VUmNII61nkPp5L7qhHO2OPG354kQjPdcXDYG6rpXOcsS4xmZtVZPlONDJ0if5RgVmVT2KbTqxO67HFwdsMLcizxv9yF91Owqtnoj/OiUp89aYepa4SA= 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:ErrorRetry; CAT:NONE; SFS:(4636009)(136003)(376002)(39860400002)(346002)(396003)(46966006)(36840700001)(6666004)(107886003)(36756003)(5660300002)(70206006)(2906002)(8936002)(4326008)(26005)(66616009)(235185007)(316002)(6916009)(81166007)(36860700001)(356005)(86362001)(8676002)(63350400001)(70586007)(33964004)(82740400003)(478600001)(8886007)(44832011)(55016002)(47076005)(4743002)(44144004)(16526019)(63370400001)(186003)(82310400003)(2616005)(7696005)(956004)(336012)(4216001)(36900700001)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Feb 2021 19:18:02.0193 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c7a91a96-93d0-4a4c-ddec-08d8d82fbd1b 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: AM5EUR03FT026.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB5500 X-Spam-Status: No, score=-14.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_LOTSOFHASH, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tamar Christina via Gcc-patches From: Tamar Christina Reply-To: Tamar Christina Cc: nd@arm.com, rguenther@suse.de Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi Richi, The attached testcase shows a bug where two nodes end up with the same pointer. During the loop that analyzes all the instances in optimize_load_redistribution_1 we do if (value) { SLP_TREE_REF_COUNT (value)++; SLP_TREE_CHILDREN (root)[i] = value; vect_free_slp_tree (node); } when doing a replacement. When this is done and the refcount for the node reaches 0, the node is removed, which allows the libc to return the pointer again in the next call to new, which it does.. First instance note: node 0x5325f48 (max_nunits=1, refcnt=2) note: op: VEC_PERM_EXPR note: { } note: lane permutation { 0[0] 1[1] 0[2] 1[3] } note: children 0x5325db0 0x5325200 Second instance note: node 0x5325f48 (max_nunits=1, refcnt=1) note: op: VEC_PERM_EXPR note: { } note: lane permutation { 0[0] 1[1] } note: children 0x53255b8 0x5325530 This will end up with the illegal construction of note: node 0x53258e8 (max_nunits=2, refcnt=2) note: op template: slp_patt_57 = .COMPLEX_MUL (_16, _16); note: stmt 0 _16 = _14 - _15; note: stmt 1 _23 = _17 + _22; note: children 0x53257d8 0x5325d28 note: node 0x53257d8 (max_nunits=2, refcnt=3) note: op template: l$b_4 = MEM[(const struct a &)_3].b; note: stmt 0 l$b_4 = MEM[(const struct a &)_3].b; note: stmt 1 l$c_5 = MEM[(const struct a &)_3].c; note: load permutation { 0 1 } note: node 0x5325d28 (max_nunits=2, refcnt=8) note: op template: l$b_4 = MEM[(const struct a &)_3].b; note: stmt 0 l$b_4 = MEM[(const struct a &)_3].b; note: stmt 1 l$c_5 = MEM[(const struct a &)_3].c; note: stmt 2 l$b_4 = MEM[(const struct a &)_3].b; note: stmt 3 l$c_5 = MEM[(const struct a &)_3].c; note: load permutation { 0 1 0 1 } To prevent this my initial thought was to add the temporary VEC_PERM_EXPR nodes to the bst_map cache and increase their refcnt one more. However since bst_map is gated on scalar statements and these nodes have none we can't do that. Instead I realized that load_map is really only a visited list at the top level. So instead of returning the reference, we should return NULL. What this means is that it will no replacement was found at that level. This is fine since these VEC_PERM_EXPR are single use. So while the any other node is an indication to use the cache, VEC_PERM_EXPR are an indication to avoid it. Bootstrapped Regtested on aarch64-none-linux-gnu and no issues. Ok for master? Thanks, Tamar gcc/ChangeLog: PR tree-optimization/99220 * tree-vect-slp.c (optimize_load_redistribution_1): Don't use VEC_PERM_EXPR in cache. gcc/testsuite/ChangeLog: PR tree-optimization/99220 * g++.dg/vect/pr99220.cc: New test. --- inline copy of patch -- diff --git a/gcc/testsuite/g++.dg/vect/pr99220.cc b/gcc/testsuite/g++.dg/vect/pr99220.cc new file mode 100755 index 0000000000000000000000000000000000000000..ff3058832b742414202a8ada0a9dafc72c9a54aa diff --git a/gcc/testsuite/g++.dg/vect/pr99220.cc b/gcc/testsuite/g++.dg/vect/pr99220.cc new file mode 100755 index 0000000000000000000000000000000000000000..ff3058832b742414202a8ada0a9dafc72c9a54aa --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr99220.cc @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-w -O3 -march=armv8.3-a" { target { aarch64*-*-* } } } */ + +class a { + float b; + float c; + +public: + a(float d, float e) : b(d), c(e) {} + a operator+(a d) { return a(b + d.b, c + d.c); } + a operator-(a d) { return a(b - d.b, c - d.c); } + a operator*(a d) { return a(b * b - c * c, b * c + c * d.b); } +}; +long f; +a *g; +class { + a *h; + long i; + a *j; + +public: + void k() { + a l = h[0], m = g[i], n = l * g[1], o = l * j[8]; + g[i] = m + n; + g[i + 1] = m - n; + j[f] = o; + } +} p; +main() { p.k(); } diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index 605873714a5cafaaf822f61f1f769f96b3876694..e631463be8fc5b2de355e674a9c96665beb9516c 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -2292,7 +2292,12 @@ optimize_load_redistribution_1 (scalar_stmts_to_slp_tree_map_t *bst_map, slp_tree root) { if (slp_tree *leader = load_map->get (root)) - return *leader; + { + if (SLP_TREE_CODE (root) == VEC_PERM_EXPR) + return NULL; + else + return *leader; + } load_map->put (root, NULL);