On 02/02/2017 02:18 PM, Martin Liška wrote: > Ok, I spent more time with understanding how that pass works and I believe it > can be > significantly simplified. I guess target_clones are very close to 'target' > attribute > that is handled by C++ FE. It creates cgraph_function_version_info and > function dispatcher > is generated. > > I hope doing the very same by an early simple IPA pass should be the right > approach. > Works fine apart from an assert it triggers: > > $ ./xgcc -B. > /home/marxin/Programming/gcc/gcc/testsuite/gcc.target/i386/mvc9.c -flto -O1 > lto1: internal compiler error: in binds_to_current_def_p, at symtab.c:2239 > 0x8c580a symtab_node::binds_to_current_def_p(symtab_node*) > ../../gcc/symtab.c:2239 > 0x18cb40b worse_state > ../../gcc/ipa-pure-const.c:477 > 0x18cd61f propagate_pure_const > ../../gcc/ipa-pure-const.c:1346 > 0x18ce304 execute > ../../gcc/ipa-pure-const.c:1679 > > triggered for foo.ifunc: > > foo.ifunc/6 (foo.ifunc) @0x7f9535b138a0 > Type: function definition analyzed alias > Visibility: prevailing_def_ironly artificial > References: foo.resolver/7 (alias) > Referring: > Read from file: /tmp/ccdj2ikS.o > Availability: overwritable > First run: 0 > Function flags: > Called by: main/2 (1.00 per call) > Calls: > > The assert is removed in attached patch, but maybe there's a better approach?
After discussion with Honza, we agreed that the function should bail out when declaration has ifunc attribute. I'm going to install it as separate patch right after proper testing. Martin > > Thanks, > Martin >
>From 3f1d907737cf132f52c7a85d697e1f9d267efa86 Mon Sep 17 00:00:00 2001 From: marxin <mli...@suse.cz> Date: Fri, 3 Feb 2017 14:33:16 +0100 Subject: [PATCH] Bail out binds_to_current_def_p for ifunc functions. gcc/ChangeLog: 2017-02-03 Martin Liska <mli...@suse.cz> * symtab.c (symtab_node::binds_to_current_def_p): Bail out in case of a function with ifunc attribute. --- gcc/symtab.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gcc/symtab.c b/gcc/symtab.c index 0078896c8a8..f0baf081040 100644 --- a/gcc/symtab.c +++ b/gcc/symtab.c @@ -2225,6 +2225,8 @@ symtab_node::binds_to_current_def_p (symtab_node *ref) if (transparent_alias) return definition && get_alias_target()->binds_to_current_def_p (ref); + if (lookup_attribute ("ifunc", DECL_ATTRIBUTES (decl))) + return false; if (decl_binds_to_current_def_p (decl)) return true; -- 2.11.0