On 6/5/19 6:51 AM, Richard Biener wrote:
> 
> The following was inspired by Marins work on escapes of locals
> and the discussion there.  It teaches points-to analysis that
> the point of function return is special and thus escapes through
> that a) do not influence other points-to solutions, b) can be
> pruned of all locals.
> 
> This is one example of reasonably simple "post-processing".
> 
> The effects are small, I've done statistics, counting the number
> of variables we do not mark escaped only after this patch.  This
> number is usually zero, sometimes one and a few cases more
> (but never more than 11) during bootstrap:
> 
> 0 95830
> 1 19268
> 2 19
> 3 2
> 5 2
> 6 1
> 8 1
> 11 1
> 
> so not sure if it is worth all the effort.  It does allow us
> to do more DSE but that requires the accesses to be indirect
> which is not often true for locals.
> 
> Bootstrapped / tested on x86_64-unknown-linux-gnu.
> 
> Martin, does this help you at all?  Anybody thinks this is
> worth the trouble?
> 
> Thanks,
> Richard.
> 
> 2019-06-05  Richard Biener  <rguent...@suse.de>
> 
>       * tree-ssa-structalias.c: Include tree-cfg.h.
>       (make_heapvar): Do not make heap vars artificial.
>       (find_func_aliases_for_builtin_call): Handle stack allocation
>       functions.
>       (find_func_aliases): Delay processing of simple enough returns
>       in non-IPA mode.
>       (set_uids_in_ptset): Adjust.
>       (find_what_var_points_to): Likewise.
>       (solve_constraints): Do not dump points-to sets here.
>       (compute_points_to_sets): Post-process return statements,
>       amending the escaped solution.  Dump points-to sets afterwards.
>       (ipa_pta_execute): Dump points-to sets.
> 
>       * gcc.dg/tree-ssa/alias-37.c: New testcase.
>       * gcc.dg/torture/20190604-1.c: Likewise.
>       * gcc.dg/tree-ssa/pta-callused.c: Adjust.
It's a fair amount of code for a corner case, _but_ I think it's a step
in the right direction.  I suspect we ought to be using the alias oracle
solutions for more than we are today and improved precision certainly
doesn't hurt.

Jeff

Reply via email to