On Wed, Jan 16, 2019 at 10:20 AM Martin Liška <mli...@suse.cz> wrote: > > Hi. > > The patch is about resetting TYPE_MODE of vector types. This is problematic > when an inlining among different ISAs happen. Then we end up with a different > mode than when it's expected from debug info. > > When creating a new function decl in target_clones, we must valid_attribute_p > early > so that the declaration has a proper cl_target_.. node and so that inliner can > fix modes. > > Patch can bootstrap on x86_64-linux-gnu and survives regression tests. > > Ready to be installed?
I don't like the new failure mode too much. It looks like create_version_clone_with_body can fail so why not simply return NULL when targetm.target_option.valid_attribute_p returns false and handle that case in multi-versioning? That is, + return !seen_error (); that looks very wrong to me. Richard. > Thanks, > Martin > > gcc/ChangeLog: > > 2019-01-16 Martin Liska <mli...@suse.cz> > Richard Biener <rguent...@suse.de> > > PR middle-end/88587 > * cgraph.h (create_version_clone_with_body): Add new argument > with attributes. > * cgraphclones.c (cgraph_node::create_version_clone): Add > DECL_ATTRIBUTES to a newly created decl. And call > valid_attribute_p so that proper cl_target_optimization_node > is set for the newly created declaration. > * multiple_target.c (create_target_clone): Set DECL_ATTRIBUTES > for declaration. > (expand_target_clones): Do not call valid_attribute_p, it must > be already done. > * tree-inline.c (copy_decl_for_dup_finish): Reset mode for > vector types. > > gcc/testsuite/ChangeLog: > > 2019-01-16 Martin Liska <mli...@suse.cz> > > PR middle-end/88587 > * g++.target/i386/pr88587.C: New test. > * gcc.target/i386/mvc13.c: New test. > --- > gcc/cgraph.h | 7 +++++- > gcc/cgraphclones.c | 18 +++++++++++++- > gcc/multiple_target.c | 32 ++++++++----------------- > gcc/testsuite/g++.target/i386/pr88587.C | 15 ++++++++++++ > gcc/testsuite/gcc.target/i386/mvc13.c | 9 +++++++ > gcc/tree-inline.c | 4 ++++ > 6 files changed, 61 insertions(+), 24 deletions(-) > create mode 100644 gcc/testsuite/g++.target/i386/pr88587.C > create mode 100644 gcc/testsuite/gcc.target/i386/mvc13.c > >