[PATCH]: Change may_aliases to use bitmaps

Diego Novillo dnovillo@redhat.com
Mon Jan 29 07:24:00 GMT 2007


Daniel Berlin wrote on 01/28/07 22:50:

> This saves us a *huge* amount of memory on large testcases, usually
> about 50-60%.
> In addition, on every case that has > 0.01 seconds spent on aliasing,
> it's about a 5-10% compile time reduction.
> 
Nice!  I got the opposite result when I tried this a long time ago.

> Note that there is a followup to this patch to remove the is_aliased
> bit, as it is only used in tree-ssa-live.c, and we waste time
> computing it.
> 
Do we truly not needed anymore?  I remember using it in the operand
scanner in some edge cases for adding VDEFs, but I'm away from the
code right now.  If it's really not needed, then great.

> Bootstrapped and regtested on i686-apple-darwin.  I'll wait a day in
> case anyone wants to comment, but this literally only touches alias
> related things, even though it spans multiple files.
> 
Before you commit, I have a couple of questions below.

> +/* This function computes the value of the is_aliased bit for
> +   variables.  is_aliased is true for any variable that is in an
> +   alias bitmap.  */
> +
> +static void
> +compute_is_aliased (void)
> +{
> +  referenced_var_iterator rvi;
> +  tree tag;
> +  bitmap aliased_vars = BITMAP_ALLOC (NULL);
> +  bitmap_iterator bi;
> +  unsigned int i;
> +  
> +  /* Add is_aliased for all vars pointed to by the symbol tags.  */
> +  FOR_EACH_REFERENCED_VAR (tag, rvi)
> +    {
> +      bitmap aliases;
> +      if (TREE_CODE (tag) != SYMBOL_MEMORY_TAG
> +	  && TREE_CODE (tag) != NAME_MEMORY_TAG)
> +	continue;
> +      aliases = MTAG_ALIASES (tag);
> +      if (!aliases)
> +	continue;
> +      
> +      bitmap_ior_into (aliased_vars, aliases);	  
> +    }
> +  
> +  EXECUTE_IF_SET_IN_BITMAP (aliased_vars, 0, i, bi)
> +    {
> +      tree var = referenced_var (i);
> +      
> +      var_ann (var)->is_aliased = true;
> +    }
> +  
> +  BITMAP_FREE (aliased_vars);
> +}
> +
>  
This doesn't make sense to me.  We set 'is_aliased' on demand every
time we call add_may_alias.  What problem did you run into that forced
you to do this?

> +/* Union the alias set SET into the may-aliases for TAG */
> +static void
> +union_alias_set_into (tree tag, bitmap set)
>
Vertical spacing after comment.


Thanks for the cleanup.  Long overdue.



More information about the Gcc-patches mailing list