diff mbox series

[1/8] parloops: Copy target and optimizations when creating a function clone

Message ID 9c15446b-1f4d-62d7-9427-a19eb07ac8ee@arm.com
State New
Headers show
Series [1/8] parloops: Copy target and optimizations when creating a function clone | expand

Commit Message

Andre Vieira (lists) Aug. 30, 2023, 9:06 a.m. UTC
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.

Comments

Richard Biener Aug. 30, 2023, 12:31 p.m. UTC | #1
On Wed, 30 Aug 2023, Andre Vieira (lists) wrote:

> 
> 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.

OK.

> gcc/ChangeLog:
> 
> 	* tree-parloops.cc (create_loop_fn): Copy specific target and
> 	optimization options to clone.
>
Andre Vieira (lists) Oct. 18, 2023, 2:40 p.m. UTC | #2
Just posting a rebase for completion.

On 30/08/2023 13:31, Richard Biener wrote:
> On Wed, 30 Aug 2023, Andre Vieira (lists) wrote:
> 
>>
>> 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.
> 
> OK.
> 
>> gcc/ChangeLog:
>>
>> 	* tree-parloops.cc (create_loop_fn): Copy specific target and
>> 	optimization options to clone.
>>
>
diff --git a/gcc/tree-parloops.cc b/gcc/tree-parloops.cc
index e495bbd65270bdf90bae2c4a2b52777522352a77..a35f3d5023b06e5ef96eb4222488fcb34dd7bd45 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);
diff mbox series

Patch

diff --git a/gcc/tree-parloops.cc b/gcc/tree-parloops.cc
index e495bbd65270bdf90bae2c4a2b52777522352a77..a35f3d5023b06e5ef96eb4222488fcb34dd7bd45 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);