On 9/14/22 12:12, Jakub Jelinek wrote: > If it is pure optimization thing and purely keyed on the definition, > all the simd clones should be local to the TU, never exported from it. OK, here is a revised patch that addresses that. x86_64 target also generates a different set of clones for functions with internal linkage vs external so I hacked that to treat these implicit clones in the same way as other internal clones. There is an existing problem with internal "declare simd" clones in that nothing ever DCEs clones that end up not being useful, or does a scan of the code in the compilation unit before clone generation to avoid generating useless clones in the first place. I haven't tried to solve that problem, but I did attempt to mitigate it for these implicit "declare target" clones by tagging the option OPT_LEVELS_2_PLUS_SPEED_ONLY (instead of enabling it by default all the time) so the clones are not generated by default at -Os and -Og. I added a couple new test cases to check this. On 9/14/22 15:45, Thomas Schwinge wrote: > However, OpenACC and OpenMP support may be active at the same time... > >> + if (attr == NULL_TREE >> + && flag_openmp_target_simd_clone && !flag_openacc) > > ..., so '!flag_openacc' is not the right check here. Instead you'd do > '!oacc_get_fn_attrib (DECL_ATTRIBUTES (node->decl))' (untested) or > similar. This is fixed now too. OK to check in? -Sandra