From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60075.outbound.protection.outlook.com [40.107.6.75]) by sourceware.org (Postfix) with ESMTPS id 22F99388A436 for ; Tue, 9 Mar 2021 15:41:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 22F99388A436 Received: from AM5PR1001CA0001.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:206:2::14) by VI1PR08MB5488.eurprd08.prod.outlook.com (2603:10a6:803:137::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.28; Tue, 9 Mar 2021 15:41:22 +0000 Received: from VE1EUR03FT009.eop-EUR03.prod.protection.outlook.com (2603:10a6:206:2:cafe::e1) by AM5PR1001CA0001.outlook.office365.com (2603:10a6:206:2::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Tue, 9 Mar 2021 15:41:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (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=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; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT009.mail.protection.outlook.com (10.152.18.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Tue, 9 Mar 2021 15:41:21 +0000 Received: ("Tessian outbound e7a0046930fb:v71"); Tue, 09 Mar 2021 15:41:21 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 54534a588aae0235 X-CR-MTA-TID: 64aa7808 Received: from 04e8d21c06a1.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id CE8002A9-204C-4B9B-A388-7D0C69DF0968.1; Tue, 09 Mar 2021 15:41:04 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 04e8d21c06a1.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 09 Mar 2021 15:41:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ANt6Z8DA1Xr76eCwxV7BPxDZ5zEjiTnaph1PDQ1PqHmks+tvgkJNAYc+kehG/YyK3NYlRiesNOW3P89npOvFj9HXGSuj7Jt4dDkrm7Xqu1tYh+YZ/St7Alf8exhi+HkvfZtHvmpahRoG4cORnHLF/wPVWMzuG18kYy43fqnewPMIqthmoLCi7Sif/f5JtF3MpQdM3giHxUc4zEiu9dq9wuaE5FounJ7IS24LoM0UPABllkz4NAODAZMEyz6Dp4QICfUY3daHj/IqF5PbPH/64Wo6PgrQw7Nj7Vz5006dbKAsgof3mzbGgiHLAnJNFenzGdtwRqF96bFe1YLns7chgg== 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=qmVjkjpeyhMJIw3H01giq7WznBGOMCtTcj7sy7WIf1U=; b=WHqRnrQiuZo9J+bOVtLopy+Jg4ULZk6AEacBJUtYlExk5dlomJZD6kgWwrY2fvIKQSaFr47/FLt1unvdRnYAt1bQqM3Gz/eB3muhN+aK9IeqX/O8zQ6InLuV3a2uBkIR7aDxlUgtpZKGKZPDpjZHa1BIxTTL3/RF3A1SAIoVHomlaWeEatyBsYSIDpGXLPuD963GC43opTqikzoBX0a0uOWsrTKS0dIeABjd9nlfyZbzO1L7USn3JZULSfMuicFi+8DMK225hsKHRPH1NrRVE1uhND2zxDuU9xQYUzpyd4+DKX7iw1zOgDQmBDKrYjlZNT0WSiB6MZCSNSL5uXbYWg== 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 VI1PR08MB4029.eurprd08.prod.outlook.com (2603:10a6:803:ec::14) by VI1PR08MB5343.eurprd08.prod.outlook.com (2603:10a6:803:12d::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17; Tue, 9 Mar 2021 15:41:02 +0000 Received: from VI1PR08MB4029.eurprd08.prod.outlook.com ([fe80::91e5:a54c:eda6:49b2]) by VI1PR08MB4029.eurprd08.prod.outlook.com ([fe80::91e5:a54c:eda6:49b2%4]) with mapi id 15.20.3912.027; Tue, 9 Mar 2021 15:41:02 +0000 Date: Tue, 9 Mar 2021 15:41:00 +0000 From: Alex Coplan To: gcc-patches@gcc.gnu.org Cc: Richard Earnshaw , Richard Sandiford , Kyrylo Tkachov , Richard Biener Subject: [PATCH v2] aarch64: Fix SVE ACLE builtins with LTO [PR99216] Message-ID: <20210309154058.5u6cvoo52yrijpue@arm.com> Content-Type: multipart/mixed; boundary="lasfrj3lz4xcwwxj" Content-Disposition: inline User-Agent: NeoMutt/20171215 X-Originating-IP: [217.140.106.55] X-ClientProxiedBy: LO2P265CA0473.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a2::29) To VI1PR08MB4029.eurprd08.prod.outlook.com (2603:10a6:803:ec::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from arm.com (217.140.106.55) by LO2P265CA0473.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a2::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.26 via Frontend Transport; Tue, 9 Mar 2021 15:41:01 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 1d735de3-c242-4437-8f82-08d8e311ca47 X-MS-TrafficTypeDiagnostic: VI1PR08MB5343:|VI1PR08MB5488: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8882;OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: PO75PCZ21VxjbqmCqQ06DtA7JnfsOg0yt4c+Mwmb0gDexG8aHGk2UlwY4/PlO3iZG0Y2MB7lsarkye/dr4QpfdFA01n0HJHyxDwxUuMW5iJlW74nW4Q5yY309zAlCUl+10SWqiuAqdfr9VPpCCu75J9YnXEft4nqrMQgR6ywNJl3R02hEUJFmsKuRv7z+F5Dr79idNFISOxdhX7iUDwQUFFIMHoC6kPP3EOwn0sj0srYzQG9hYXCmXZIUAYibv6X0yaKi49w9qT8HdhUFpWnoF8QwK09SpgK4pEvIh3OFMKtUuMz4t2PF1e7MEULcRZEPCfo8zS3T7ewpkA7UQw3o5t+HnfekI9OSk3fJeBjE8GF6LiX1seC8qKxtLD27dCwUoY+Ycu0MjI8SKNOnXFwUiyQuxE+qVFOUsX4ZIBPpcvPImyn01TxEqC7N2qdknVQmVXIReR0eYufkuK+G7BCTWpI/B60W/Htb1e0Adyfz9mHKFs9pe4JP2Lw1kkX1AvSZGfX/7uQ9AychmBhPCobV5GZLT6ioTDt74s9IR6GMAC6igC5R7jWOgbS7x0F8hsgdEOrRgTUKlQkoeD6dNV7oVJsBA44DjFjOjIGA3pHDM/81inSgAqmtNGRybAk+Ko0cnY6awcsJiNED1C4AUjrxA== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR08MB4029.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(396003)(39860400002)(366004)(136003)(346002)(21480400003)(36756003)(8676002)(8936002)(186003)(66946007)(86362001)(1076003)(966005)(478600001)(26005)(66616009)(66476007)(66556008)(6916009)(956004)(316002)(2616005)(54906003)(44832011)(5660300002)(235185007)(44144004)(55016002)(2906002)(16526019)(7696005)(52116002)(8886007)(4326008)(33964004)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?B?bGJrbHh5ZEN6eDdHZEs0dHc3RDgxeWNteVF5WWR6ekFFTlVZUk4wUThrWFpj?= =?utf-8?B?NEI5TktXNDVKYm1tUVdOQjBjZmZOM3IwT2QveHF2SUM3Y2ZIZlJMektTRmJi?= =?utf-8?B?a1lEMjlGWEdRMk42dldabXIrd0l6WVFsUjB4ZXFPK1JBOXVhT0ZnTzJnSTdj?= =?utf-8?B?SkVYalRMZnZCbC93eXF6T0lBUmJpZ1FCN0JrbE85UWF0cjBzdzlablllQjlE?= =?utf-8?B?VmJqclZSQzJvT2ZUUlZUdHZSL1ZUYzRlclU0TGJqZkl6OGlHSzcxMkZxMHFx?= =?utf-8?B?ZHhuUU1aaGZBampMcEhiNWMzZGZ2UnNEZDdDQ20yUjAybmVVejFRd3dGdW0w?= =?utf-8?B?THVXbTFnR2lRVGxudjNVQkVIR0FUaUoyc21jYWRMZGNkdFF6WFh5QWlyRlNx?= =?utf-8?B?V3NieUdnMDhGZ0ZKRk53eGhucFJJQk1EQlB0cUxBSGVRRkFCWFNvUDR5a1Ny?= =?utf-8?B?R0N3T0c4TnNNNDJXL1AyZjZFREk4QmVDbmFtOWRGdVBHVnVyd3g3Y1ovcFoz?= =?utf-8?B?dzB0R1hCSTJUdk5leWJWUzRrbWIxOXBHZ3VpUXNUOUFZQWNoN3E1dUk1YkEy?= =?utf-8?B?Njd0c2lQWURINUhKOVdaTEpCbXdwcmhFaW5vQ0dkK0hkcFZvUWhiMmdxaFJq?= =?utf-8?B?ODJLVUhGc2pIdHBzbFAwbC9PN21Ocld1ZGphdWxsRzRta2lJVy9zWlBST0NW?= =?utf-8?B?K1VWU3dkUUZSTlh0ek1vVHdBMDJWNXFCNXJhOGJ6c3ZuTTd4YW84K2w5N05M?= =?utf-8?B?RWl0dmtCL05xRnVyYnVVU1QvdGZwTE9Ob25jVE5ZMk1pZCtpWXRCTlRvaW56?= =?utf-8?B?RmxsUFhzWk1RTm85SFg3VnFKditsaVhuSU5mTCtEVzVMcnpabGdZMXZvR09s?= =?utf-8?B?TFgrRmNRVDlzVFBrT0lJTzZaWEFHeDVTWnQwU3NWNXczZXNtWW9OV2t2NHcw?= =?utf-8?B?WS91azZUYVRMam1UL01YY3NDS3p4Z0EvU1pmRWdzMGJ5Rm51YzhOemdHOWND?= =?utf-8?B?ek5XbU5uV0JaTkc4cG0rYnBkNVY1c3IwWktaV2ZyR1pVbjBjM1pOMTArNitX?= =?utf-8?B?QmZKM21uZFR5YnZ5NzYzblVMUXhzTC83ZURxUENGRnQwdWdMamRHRk9yWkdJ?= =?utf-8?B?ZVA5NGkvVG16TjFSeGZQa3QzVU9xaHVUek4yTmFlYytHL3phcFRWc1g4a2gr?= =?utf-8?B?UzEveVY1OFdKcXZhSGpHcE8zVXd1Y1MrZk40Z0ZxTENYSEU1TGg2RzB3Ty9Y?= =?utf-8?B?akJiT2lKZXNWM2dvKzk4NzE5Vmd3VEdMNHZGV3dIZTBjVTJTQVNEcldqaHdB?= =?utf-8?B?WFJnNWlkYXM0TDV5eWxxdWpOZ3p1R0lOSWFtZCtYTW40RC9WSzMrODA4Ni9C?= =?utf-8?B?ZmdHYmgwakhmSnpqYnRJUnpuOGd0Yk1PamxCTUZUTEo3QmRrblpQRXdpdnZw?= =?utf-8?B?NWVMZFZDSVZhZHhWU1RGVUZrWlJ4RThwQUhneXVVNm9GZzVWRHV3emo2OUZE?= =?utf-8?B?dEZpNnc5ZHVFR2R6NFdqUGNmUDQxdVZCRmt2SllUVmtpNzQrUFJiRWJ0Uyt0?= =?utf-8?B?ZHczREt1VW81ZG1OTFhvMHczbkYvODkrNlIzcHdVOE9OUVBsR1VrYzlvM3l6?= =?utf-8?B?OEFvTHVLS3VBL2UvTEN4cnVjcW5McVdPaEoxNE90TkFlYzBYbkdvVjZxK3Bp?= =?utf-8?B?dXFhWDU0Q0pkaWpLWkwxeVJDNDltR0ZYRHRaM0czSjhydjhkV0IyQjFoV2dW?= =?utf-8?Q?eppcSZIP5Ek9DlIWaxfD/S8Y+bwdPJGOfcuirsY?= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB5343 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: VE1EUR03FT009.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 2626c5b9-4ed1-4a19-d75b-08d8e311be60 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vE0kYczjpm4oVpEotGcESgAYzbt1C42zcoxGudskwvTm9gs0Pf1uMZpMPhlp37YXKgDHqu2eDV516kIL+G4H7Tvqa2cls+pQeAZOUUU4FBr7++H9MSZ91ItTju4LdS0SwNfHaA2xgsmdGB6/PDF+Cxe0sLwZa9GTW+Dt4z2afF4kJ7Hmihgt3e2n8u2B75mwwCwOZctAOZSkbggtQVUIz1hYgFP5AI/1D3RaO7kmm0kT2FKm7A8cxMr1ax3ACACMVS9+hUy6/M8WYkq4Jq3ftEpVIXuqpfHm9rKO4HBQ8+PQQHvIkiSgw3lOOdbhcpJgwC7+e+COOp8N3a0tfffGg4wKfQkyxu+OM1II4Ybs86gjg+J9NkFI/iZZCPQrP9mvcrkOzBzvZAExXCQ6L7467Dhnelaq2GzrF5WUuPiVrIV6+vaRtivtom9vHNRZEwMYPVL177Sd6IiudAcVPMOd1zEJKz4mnQl9bKcX8hD2DftDpsGzYHF3XD0s4tbp/uVsqam4Ul4bXSpBnBA/XO1xZYX2KFd1BbWKVRMYVMoV4JwXeMKs3yGR/aabL9+ZjQuGAFIr3xu51z7RSWEzqRn4M3z11ZggUlQd1KLF/Bu8Qt+Rr75zv8jSp4o1QomBxeCHZGHrRxYSK1SLcV2wC+QDxcNHPEjCJktibhm8ylr0sM6ZY/ceMvLUWBPyHLJx7YyduIVIkWHvzmO0j3F/+JcURG47h2a/5m01qzTz2Tp3pIWHOrgybnyL3ZUgBKi0vwYohwl5a2RjBIwMOgQCcXRB9w== 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:(4636009)(376002)(39860400002)(396003)(136003)(346002)(36840700001)(46966006)(36860700001)(2906002)(55016002)(82310400003)(107886003)(21480400003)(186003)(70206006)(86362001)(26005)(16526019)(82740400003)(47076005)(81166007)(356005)(66616009)(7696005)(2616005)(956004)(44144004)(33964004)(8676002)(8936002)(54906003)(966005)(4326008)(44832011)(316002)(6916009)(8886007)(1076003)(70586007)(478600001)(336012)(36756003)(5660300002)(235185007)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2021 15:41:21.8812 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1d735de3-c242-4437-8f82-08d8e311ca47 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: VE1EUR03FT009.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB5488 X-Spam-Status: No, score=-14.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_SHORT, 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-List-Received-Date: Tue, 09 Mar 2021 15:41:27 -0000 --lasfrj3lz4xcwwxj Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Hi all, Here is a v2 patch which provides a more obviously fake answer to TARGET_BUILTIN_DECL: this can hopefully go in for GCC 11. For GCC 12, it seems that we should consider removing the target hook. Original patch: https://gcc.gnu.org/pipermail/gcc-patches/2021-March/566405.html --- As discussed in the PR, we currently have two different numbering schemes for SVE builtins: one for C, and one for C++. This is problematic for LTO, where we end up getting confused about which intrinsic we're talking about. This patch inserts placeholders into the registered_functions vector to ensure that there is a consistent numbering scheme for both C and C++. This patch uses integer_zero_node as a placeholder node instead of building a function decl. This is safe because the node is only returned by the TARGET_BUILTIN_DECL hook, which (on AArch64) is only used for validation when builtin decls are streamed into lto1. Bootstrapped and regtested on aarch64-linux-gnu, OK for trunk? Thanks, Alex gcc/ChangeLog: PR target/99216 * config/aarch64/aarch64-sve-builtins.cc (function_builder::add_function): Add placeholder_p argument, use placeholder decls if this is set. (function_builder::add_unique_function): Instead of conditionally adding direct overloads, unconditionally add either a direct overload or a placeholder. (function_builder::add_overloaded_function): Set placeholder_p if we're using C++ overloads. Use the obstack for string storage instead of relying on the tree nodes. (function_builder::add_overloaded_functions): Don't return early for m_direct_overloads: we need to add placeholders. * config/aarch64/aarch64-sve-builtins.h (function_builder::add_function): Add placeholder_p argument. gcc/testsuite/ChangeLog: PR target/99216 * g++.target/aarch64/sve/pr99216.C: New test. --lasfrj3lz4xcwwxj Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="patch_v2.txt" diff --git a/gcc/config/aarch64/aarch64-sve-builtins.cc b/gcc/config/aarch64/aarch64-sve-builtins.cc index 25612d2ea52..f44f81f1375 100644 --- a/gcc/config/aarch64/aarch64-sve-builtins.cc +++ b/gcc/config/aarch64/aarch64-sve-builtins.cc @@ -999,12 +999,29 @@ registered_function & function_builder::add_function (const function_instance &instance, const char *name, tree fntype, tree attrs, uint64_t required_extensions, - bool overloaded_p) + bool overloaded_p, + bool placeholder_p) { unsigned int code = vec_safe_length (registered_functions); code = (code << AARCH64_BUILTIN_SHIFT) | AARCH64_BUILTIN_SVE; - tree decl = simulate_builtin_function_decl (input_location, name, fntype, - code, NULL, attrs); + + /* We need to be able to generate placeholders to enusre that we have a + consistent numbering scheme for function codes between the C and C++ + frontends, so that everything ties up in LTO. + + Currently, tree-streamer-in.c:unpack_ts_function_decl_value_fields + validates that tree nodes returned by TARGET_BUILTIN_DECL are non-NULL and + some node other than error_mark_node. This is a holdover from when builtin + decls were streamed by code rather than by value. + + Ultimately, we should be able to remove this validation of BUILT_IN_MD + nodes and remove the target hook. For now, however, we need to appease the + validation and return a non-NULL, non-error_mark_node node, so we + arbitrarily choose integer_zero_node. */ + tree decl = placeholder_p + ? integer_zero_node + : simulate_builtin_function_decl (input_location, name, fntype, + code, NULL, attrs); registered_function &rfn = *ggc_alloc (); rfn.instance = instance; @@ -1036,7 +1053,7 @@ function_builder::add_unique_function (const function_instance &instance, argument_types.address ()); tree attrs = get_attributes (instance); registered_function &rfn = add_function (instance, name, fntype, attrs, - required_extensions, false); + required_extensions, false, false); /* Enter the function into the hash table. */ hashval_t hash = instance.hash (); @@ -1047,16 +1064,14 @@ function_builder::add_unique_function (const function_instance &instance, /* Also add the function under its overloaded alias, if we want a separate decl for each instance of an overloaded function. */ - if (m_direct_overloads || force_direct_overloads) + char *overload_name = get_name (instance, true); + if (strcmp (name, overload_name) != 0) { - char *overload_name = get_name (instance, true); - if (strcmp (name, overload_name) != 0) - { - /* Attribute lists shouldn't be shared. */ - tree attrs = get_attributes (instance); - add_function (instance, overload_name, fntype, attrs, - required_extensions, false); - } + /* Attribute lists shouldn't be shared. */ + tree attrs = get_attributes (instance); + bool placeholder_p = !(m_direct_overloads || force_direct_overloads); + add_function (instance, overload_name, fntype, attrs, + required_extensions, false, placeholder_p); } obstack_free (&m_string_obstack, name); @@ -1077,18 +1092,19 @@ function_builder::add_overloaded_function (const function_instance &instance, { char *name = get_name (instance, true); if (registered_function **map_value = m_overload_names.get (name)) - gcc_assert ((*map_value)->instance == instance - && ((*map_value)->required_extensions - & ~required_extensions) == 0); + { + gcc_assert ((*map_value)->instance == instance + && ((*map_value)->required_extensions + & ~required_extensions) == 0); + obstack_free (&m_string_obstack, name); + } else { registered_function &rfn = add_function (instance, name, m_overload_type, NULL_TREE, - required_extensions, true); - const char *permanent_name = IDENTIFIER_POINTER (DECL_NAME (rfn.decl)); - m_overload_names.put (permanent_name, &rfn); + required_extensions, true, m_direct_overloads); + m_overload_names.put (name, &rfn); } - obstack_free (&m_string_obstack, name); } /* If we are using manual overload resolution, add one function decl @@ -1098,9 +1114,6 @@ void function_builder::add_overloaded_functions (const function_group_info &group, mode_suffix_index mode) { - if (m_direct_overloads) - return; - unsigned int explicit_type0 = (*group.shape)->explicit_type_suffix_p (0); unsigned int explicit_type1 = (*group.shape)->explicit_type_suffix_p (1); for (unsigned int pi = 0; group.preds[pi] != NUM_PREDS; ++pi) diff --git a/gcc/config/aarch64/aarch64-sve-builtins.h b/gcc/config/aarch64/aarch64-sve-builtins.h index 620e18841b2..b701f90ac1a 100644 --- a/gcc/config/aarch64/aarch64-sve-builtins.h +++ b/gcc/config/aarch64/aarch64-sve-builtins.h @@ -337,7 +337,8 @@ private: tree get_attributes (const function_instance &); registered_function &add_function (const function_instance &, - const char *, tree, tree, uint64_t, bool); + const char *, tree, tree, + uint64_t, bool, bool); /* The function type to use for functions that are resolved by function_resolver. */ diff --git a/gcc/testsuite/g++.target/aarch64/sve/pr99216.C b/gcc/testsuite/g++.target/aarch64/sve/pr99216.C new file mode 100644 index 00000000000..61a58a7fcf4 --- /dev/null +++ b/gcc/testsuite/g++.target/aarch64/sve/pr99216.C @@ -0,0 +1,5 @@ +/* { dg-do link { target aarch64_asm_sve_ok } } */ +/* { dg-additional-options "-flto" } */ +#include +bool a; +int main() { a = svaddv(svptrue_b8(), svdup_s8(0)); } --lasfrj3lz4xcwwxj--