diff mbox series

[2/X] parloops: Copy target and optimizations when creating a function clone

Message ID 08d8c50f-6338-38dc-6248-ecd9ecd54f51@arm.com
State New
Headers show
Series [2/X] parloops: Copy target and optimizations when creating a function clone | expand

Commit Message

Andre Vieira (lists) March 8, 2023, 4:21 p.m. UTC
Hi,

This patch makes sure we copy over 
DECL_FUNCTION_SPECIFIC_{TARGET,OPTIMIZATION} in parloops when creating 
function clones.  This is required for SVE clones as we will need to 
enable +sve for them, regardless of the current target options.
I don't actually need the 'OPTIMIZATION' for this patch, but it sounds 
like a nice feature to have, so you can use pragmas to better control 
options used in simd_clone generation.

gcc/ChangeLog:

         * tree-parloops.cc (create_loop_fn): Copy specific target and 
optimization options
         when creating a function clone.

Is this OK for stage 1?
diff mbox series

Patch

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