On 06/19/2014 01:39 AM, Tom de Vries wrote:
> On 19-06-14 05:53, Richard Henderson wrote:
>> Do we in fact make sure this isn't an ifunc resolver?  I don't immediately 
>> see
>> how those get wired up in the cgraph...
> 
> Richard,
> 
> using the patch below I changed the
> gcc/testsuite/gcc.target/i386/fuse-caller-save.c testcase to use an ifunc
> resolver, and observed that the fuse-caller-save optimization didn't work.
> 
> The reason the optimization doesn't work in this case is that
> default_binds_local_p_1 checks the ifunc attribute:
> ...
>   /* Weakrefs may not bind locally, even though the weakref itself is always
>      static and therefore local.  Similarly, the resolver for ifunc functions
>      might resolve to a non-local function.
>      FIXME: We can resolve the weakref case more curefuly by looking at the
>      weakref alias.  */
>   else if (lookup_attribute ("weakref", DECL_ATTRIBUTES (exp))
>        || (TREE_CODE (exp) == FUNCTION_DECL
>            && lookup_attribute ("ifunc", DECL_ATTRIBUTES (exp))))
>     local_p = false;
> ...
> 
> The default_binds_local_p_1 function is used via this path in the 
> optimization:
> get_call_reg_set_usage -> get_call_cgraph_rtl_info ->
> decl_binds_to_current_def_p -> default_binds_local_p -> 
> default_binds_local_p_1 .

Excellent.  Thanks for doing the digging I was too lazy to finish last night.


r~

Reply via email to