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 --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);
 

Reply via email to