[PATCH] Avoid redundant indirect_info computation during inderct edge cloning
Jeff Law
law@redhat.com
Sat Aug 30 06:39:00 GMT 2014
On 08/18/14 06:07, Ilya Enkovich wrote:
> On 15 Aug 23:08, Jan Hubicka wrote:
>>> Hi,
>>>
>>> I get a segafult in decl_maybe_in_construction_p during function versioning. We have following steps in clone creation (e.g. as in create_version_clone_with_body):
>>> 1. Create function decl
>>> 2. Create clone of cgraph node
>>> 3. Copy function body
>>> After the first step there is no body attached to function and DECL_STRUCT_FUNCTION for new decl is NULL. It is initialized on the third step. But on the second step get_polymorphic_call_info may be called for new function; it calls decl_maybe_in_construction_p which assumes DECL_STRUCT_FUNCTION already exists.
>>>
>>> I firstly wanted to fix decl_maybe_in_construction_p but then realized cgraph_clone_edge copy indirect_info from the original edge anyway and therefore its computation is not required at all.
>>>
>>> Following patch removes redundant indirect_info computation. Bootstrapped and regtested on linux-x86_64. Does it look OK for trunk?
>>
>> OK, plase also add testcase from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61800
>>
>> Thanks,
>> Honza
>
> Here is a version with testcase to be committed.
>
> Thanks,
> Ilya
> --
> gcc/
>
> 2014-08-18 Ilya Enkovich <ilya.enkovich@intel.com>
>
> PR ipa/61800
> * cgraph.h (cgraph_node::create_indirect_edge): Add
> compute_indirect_info param.
> * cgraph.c (cgraph_node::create_indirect_edge): Compute
> indirect_info only when it is required.
> * cgraphclones.c (cgraph_clone_edge): Do not recompute
> indirect_info fore cloned indirect edge.
Just to be 100% clear, this version is OK as well.
jeff
More information about the Gcc-patches
mailing list