diff mbox

[Pointer,Bounds,Checker,21/x] Weakrefs output

Message ID 20140602152235.GD53659@msticlxl57.ims.intel.com
State New
Headers show

Commit Message

Ilya Enkovich June 2, 2014, 3:22 p.m. UTC
Hi,

This patch prevents output of both instrumented and not instrumented weakref variants.

Thanks,
Ilya
--
gcc/

2014-06-02  Ilya Enkovich  <ilya.enkovich@intel.com>

	* cgraphunit.c (output_weakrefs): If there are both
	instrumented and original versions, output only one
	of them.

Comments

Richard Biener June 3, 2014, 9:02 a.m. UTC | #1
On Mon, Jun 2, 2014 at 5:22 PM, Ilya Enkovich <enkovich.gnu@gmail.com> wrote:
> Hi,
>
> This patch prevents output of both instrumented and not instrumented weakref variants.

Shouldn't one of them be reclaimed instead at some point?

Richard.

> Thanks,
> Ilya
> --
> gcc/
>
> 2014-06-02  Ilya Enkovich  <ilya.enkovich@intel.com>
>
>         * cgraphunit.c (output_weakrefs): If there are both
>         instrumented and original versions, output only one
>         of them.
>
>
> diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
> index c5c3333..ae9e699 100644
> --- a/gcc/cgraphunit.c
> +++ b/gcc/cgraphunit.c
> @@ -2111,9 +2111,13 @@ static void
>  output_weakrefs (void)
>  {
>    symtab_node *node;
> +  cgraph_node *cnode;
>    FOR_EACH_SYMBOL (node)
>      if (node->alias
>          && !TREE_ASM_WRITTEN (node->decl)
> +       && (!(cnode = dyn_cast <cgraph_node> (node))
> +           || !cnode->instrumented_version
> +           || !TREE_ASM_WRITTEN (cnode->instrumented_version->decl))
>         && node->weakref)
>        {
>         tree target;
Ilya Enkovich June 3, 2014, 10:58 a.m. UTC | #2
2014-06-03 13:02 GMT+04:00 Richard Biener <richard.guenther@gmail.com>:
> On Mon, Jun 2, 2014 at 5:22 PM, Ilya Enkovich <enkovich.gnu@gmail.com> wrote:
>> Hi,
>>
>> This patch prevents output of both instrumented and not instrumented weakref variants.
>
> Shouldn't one of them be reclaimed instead at some point?

Actually both version may be used.  We may have both instrumented and
not instrumented calls to the same function. Also original function
pointer may be used as value somewhere (e.g. in DECL_INIT).

Ilya

>
> Richard.
>
>> Thanks,
>> Ilya
>> --
>> gcc/
>>
>> 2014-06-02  Ilya Enkovich  <ilya.enkovich@intel.com>
>>
>>         * cgraphunit.c (output_weakrefs): If there are both
>>         instrumented and original versions, output only one
>>         of them.
>>
>>
>> diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
>> index c5c3333..ae9e699 100644
>> --- a/gcc/cgraphunit.c
>> +++ b/gcc/cgraphunit.c
>> @@ -2111,9 +2111,13 @@ static void
>>  output_weakrefs (void)
>>  {
>>    symtab_node *node;
>> +  cgraph_node *cnode;
>>    FOR_EACH_SYMBOL (node)
>>      if (node->alias
>>          && !TREE_ASM_WRITTEN (node->decl)
>> +       && (!(cnode = dyn_cast <cgraph_node> (node))
>> +           || !cnode->instrumented_version
>> +           || !TREE_ASM_WRITTEN (cnode->instrumented_version->decl))
>>         && node->weakref)
>>        {
>>         tree target;
Jeff Law June 4, 2014, 7:05 a.m. UTC | #3
On 06/02/14 09:22, Ilya Enkovich wrote:
> Hi,
>
> This patch prevents output of both instrumented and not instrumented weakref variants.
>
> Thanks,
> Ilya
> --
> gcc/
>
> 2014-06-02  Ilya Enkovich  <ilya.enkovich@intel.com>
>
> 	* cgraphunit.c (output_weakrefs): If there are both
> 	instrumented and original versions, output only one
> 	of them.
OK.
Jeff
diff mbox

Patch

diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index c5c3333..ae9e699 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -2111,9 +2111,13 @@  static void
 output_weakrefs (void)
 {
   symtab_node *node;
+  cgraph_node *cnode;
   FOR_EACH_SYMBOL (node)
     if (node->alias
         && !TREE_ASM_WRITTEN (node->decl)
+	&& (!(cnode = dyn_cast <cgraph_node> (node))
+	    || !cnode->instrumented_version
+	    || !TREE_ASM_WRITTEN (cnode->instrumented_version->decl))
 	&& node->weakref)
       {
 	tree target;