From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1971) id 860DC38582B0; Thu, 19 Oct 2023 17:30:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 860DC38582B0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1697736646; bh=tBMDjnmp8AIVxtZlPhbbWXrto/7/rXxJynMM374HVDI=; h=From:To:Subject:Date:From; b=fyalT8mLS62KDEK/tky/DXBnPKqW73eA4FbGp8suortFRzNMvhRaDqFJSC9LeGAdF vaQFFvjqfq9kBAvAyfMSfhZFG34uvUUGpofx9Xlj8SjGGYuGsPYgg3JJapgpsrHSZp TVsX3MefyhLC6Lle/RTLfBpp4BQ5a8QASuenFUB8= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Andre Simoes Dias Vieira To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-4762] parloops: Copy target and optimizations when creating a function clone X-Act-Checkin: gcc X-Git-Author: Andre Vieira X-Git-Refname: refs/heads/master X-Git-Oldrev: 79a50a17409a39759326a494d85dccfd9008a9de X-Git-Newrev: 87d97e26076a131541e8562932248bc24590e38f Message-Id: <20231019173046.860DC38582B0@sourceware.org> Date: Thu, 19 Oct 2023 17:30:46 +0000 (GMT) List-Id: https://gcc.gnu.org/g:87d97e26076a131541e8562932248bc24590e38f commit r14-4762-g87d97e26076a131541e8562932248bc24590e38f Author: Andre Vieira Date: Thu Oct 19 18:26:45 2023 +0100 parloops: Copy target and optimizations when creating a function clone SVE simd clones require to be compiled with a SVE target enabled or the argument types will not be created properly. To achieve this we need to copy DECL_FUNCTION_SPECIFIC_TARGET from the original function declaration to the clones. I decided it was probably also a good idea to copy DECL_FUNCTION_SPECIFIC_OPTIMIZATION in case the original function is meant to be compiled with specific optimization options. gcc/ChangeLog: * tree-parloops.cc (create_loop_fn): Copy specific target and optimization options to clone. Diff: --- gcc/tree-parloops.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gcc/tree-parloops.cc b/gcc/tree-parloops.cc index e495bbd65270..a35f3d5023b0 100644 --- a/gcc/tree-parloops.cc +++ b/gcc/tree-parloops.cc @@ -2203,6 +2203,11 @@ create_loop_fn (location_t loc) DECL_CONTEXT (t) = decl; TREE_USED (t) = 1; DECL_ARGUMENTS (decl) = t; + DECL_FUNCTION_SPECIFIC_TARGET (decl) + = DECL_FUNCTION_SPECIFIC_TARGET (act_cfun->decl); + DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl) + = DECL_FUNCTION_SPECIFIC_OPTIMIZATION (act_cfun->decl); + allocate_struct_function (decl, false);