On Wed, 28 Oct 2015, Tom de Vries wrote:

> Richard,
> 
> when compiling this testcase:
> ...
> static int __attribute__((noinline, noclone))
> foo (int *a, int *b)
> {
>   *b = 1;
>   *a = 2;
>   return *b;
> }
> 
> int __attribute__((noinline, noclone))
> bar (int *a, int *b)
> {
>   return foo (a, b);
> }
> ...
> 
> with -O2 -fipa-pta we find in the pta dumpfile:
> ...
> Generating constraints for bar (bar)
> 
> bar.arg0 = &NONLOCAL
> bar.arg1 = &NONLOCAL
> bar.arg1 = &NONLOCAL
> ...
> 
> The reason for the duplicate last two constraints is that with fipa-pta, in
> create_function_info_for we link the function arguments in a next chain.
> 
> And in intra_create_variable_infos there are two iteration mechanism used:
> - the loop over the function arguments
> - the loop over the vi_next (p) for each function argument p
> 
> So when processing argument a, we generate constraints for both a and it's
> next b.
> And when processing argument b, we generate constraints for b again.
> 
> Is this a known issue? Should we fix this?

Didn't see that yet.  Yes, we should fix it.

Index: gcc/tree-ssa-structalias.c
===================================================================
--- gcc/tree-ssa-structalias.c  (revision 229481)
+++ gcc/tree-ssa-structalias.c  (working copy)
@@ -5913,6 +6009,8 @@ intra_create_variable_infos (struct func
                make_constraint_from_global_restrict (p, "PARM_RESTRICT");
              else if (p->may_have_pointers)
                make_constraint_from (p, nonlocal_id);
+             if (p->is_full_var)
+               break;
            }
        }
     }

does for me.  Pre-approved if it passes testing.

Richard.

> Thanks,
> - Tom
> 
> 

-- 
Richard Biener <rguent...@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 
21284 (AG Nuernberg)

Reply via email to