OK for: <alfie.richa...@arm.com> writes: > gcc/cgraph.cc | 4 +- > gcc/cgraph.h | 2 + > gcc/cgraphunit.cc | 9 + > gcc/config/aarch64/aarch64.cc | 43 ++-- > gcc/ipa.cc | 11 + > gcc/multiple_target.cc | 188 +++++++++++++++--- > gcc/passes.def | 3 +- > gcc/testsuite/g++.target/aarch64/mv-1.C | 4 + > .../g++.target/aarch64/mv-symbols10.C | 27 +++ > .../g++.target/aarch64/mv-symbols11.C | 30 +++ > .../g++.target/aarch64/mv-symbols12.C | 28 +++ > .../g++.target/aarch64/mv-symbols13.C | 28 +++ > .../g++.target/aarch64/mv-symbols2.C | 12 +- > .../g++.target/aarch64/mv-symbols3.C | 6 +- > .../g++.target/aarch64/mv-symbols4.C | 6 +- > .../g++.target/aarch64/mv-symbols5.C | 6 +- > .../g++.target/aarch64/mv-symbols6.C | 21 ++ > .../g++.target/aarch64/mv-symbols7.C | 48 +++++ > .../g++.target/aarch64/mv-symbols8.C | 46 +++++ > .../g++.target/aarch64/mv-symbols9.C | 43 ++++ > .../g++.target/aarch64/mvc-symbols3.C | 12 +- > gcc/testsuite/g++.target/riscv/mv-symbols2.C | 12 +- > gcc/testsuite/g++.target/riscv/mv-symbols3.C | 6 +- > gcc/testsuite/g++.target/riscv/mv-symbols4.C | 6 +- > gcc/testsuite/g++.target/riscv/mv-symbols5.C | 6 +- > gcc/testsuite/g++.target/riscv/mvc-symbols3.C | 12 +-
with the changes below. > diff --git a/gcc/multiple_target.cc b/gcc/multiple_target.cc > index 57843b4ae05..39518333a86 100644 > --- a/gcc/multiple_target.cc > +++ b/gcc/multiple_target.cc > @@ -58,8 +58,15 @@ replace_function_decl (tree *op, int *walk_subtrees, void > *data) > return NULL; > } > > -/* If the call in NODE has multiple target attribute with multiple fields, > - replace it with dispatcher call and create dispatcher (once). */ > +/* In target FMV attributes, if the call in NODE has multiple target > attribute > + with multiple fields, replace it with calls to the dispatched symbol and > + create the disptacher body (once). dispatcher > + > + In target_version semantics, if it is a lone annotated default, then > + the dispatched symbol is changed to be an alias and no resolver is > + required. Otherwise, redirect all calls and references to the dispatched > + symbol, but only create the resolver body if the default version is > + implemented. */ > > static void > create_dispatcher_calls (struct cgraph_node *node) > [...] > @@ -406,15 +465,87 @@ redirect_to_specific_clone (cgraph_node *node) > } > } > > +/* Checks if NODE is a in the 'simple' target_clones case, which is where > NODE Missing word after "a", or s/a in //. > + is a declaration annotated with target_clones containing the default, and > it > + is the sole function declaration in the FMV function set. */ > + > [...] > diff --git a/gcc/passes.def b/gcc/passes.def > index d528a0477d9..9ccee70b229 100644 > --- a/gcc/passes.def > +++ b/gcc/passes.def > @@ -54,6 +54,7 @@ along with GCC; see the file COPYING3. If not see > NEXT_PASS (pass_ipa_function_and_variable_visibility); > NEXT_PASS (pass_ipa_strub_mode); > NEXT_PASS (pass_build_ssa_passes); > + NEXT_PASS (pass_target_clone, true); Sorry for not noticing last time, but I think this logically belongs either before pass_build_ssa_passes or after the POP_INSERT_PASSES. (Or perhaps as the first subpass of build_ssa_passes, but that seems less obvious.) Richard > PUSH_INSERT_PASSES_WITHIN (pass_build_ssa_passes) > NEXT_PASS (pass_fixup_cfg); > NEXT_PASS (pass_build_ssa);