[PATCH] Fix flow-insensitive alias computation
Daniel Berlin
dberlin@dberlin.org
Sat Apr 19 12:02:00 GMT 2008
On Fri, Apr 18, 2008 at 6:35 PM, Richard Guenther <rguenther@suse.de> wrote:
> On Fri, 18 Apr 2008, Richard Guenther wrote:
>
> > On Fri, 18 Apr 2008, Daniel Berlin wrote:
> >
>
> > > > So I believe the following should be in principle correct modulo
> > > > latent bugs elsewhere...
> > >
> > > This looks fine to me, but be careful.
> > > As you've discovered, this part of the code is very very fragile.
> >
> > It actually works. I am thinking to force PTA off and see if
> > anything breaks that way (that basically forces the operand scanner
> > to fall back to the pointers SMT all the time).
>
> So trying the following independent of my patches
>
> Index: gcc/tree-ssa-alias.c
> ===================================================================
> --- gcc/tree-ssa-alias.c (revision 134452)
> +++ gcc/tree-ssa-alias.c (working copy)
> @@ -2345,10 +2345,11 @@ compute_flow_sensitive_aliasing (struct
>
>
> for (i = 0; VEC_iterate (tree, ai->processed_ptrs, i, ptr); i++)
> {
> - if (!find_what_p_points_to (ptr))
> + if (1 || !find_what_p_points_to (ptr))
> set_pt_anything (ptr);
> }
>
> + return;
> create_name_tags ();
>
>
> for (i = 0; VEC_iterate (tree, ai->processed_ptrs, i, ptr); i++)
>
> shows that call-clobbering is broken (gcc.c-torture/execute/pr28778.c
> will fail) - I will have a look here.
>
> It also shows that (with my patches) char * pointers are special, so
> may_alias_p needs
>
> @@ -2868,6 +2869,16 @@ may_alias_p (tree ptr, alias_set_type me
> {
> alias_stats.tbaa_queries++;
>
> + /* If the pointed to memory has alias set zero or the pointer
> + is ref-all, the MEM can alias VAR. */
> + if (mem_alias_set == 0
> + || PTR_IS_REF_ALL (ptr))
> + {
> + alias_stats.alias_mayalias++;
> + alias_stats.tbaa_resolved++;
> + return true;
> + }
>
I can believe the PTR_IS_REF_ALL part, but alias_sets_conflict_p will
return the right answer for mem_alias_set == 0 already, and then we
only perform further disambiguation iff mem_alias_set != 0.
If you have to use the above with mem_alias_set == 0 to get the code
to work, something else is broken.
More information about the Gcc-patches
mailing list