[PATCH] Fix PR tree-opt/25500 SRA vs struct containing a vector

Diego Novillo dnovillo@redhat.com
Wed Nov 15 13:53:00 GMT 2006


Andrew_Pinski@PlayStation.Sony.Com wrote on 11/14/06 19:36:

> +	  if (TREE_CODE (elt->type) == RECORD_TYPE)
> +	    {
> +	      tree field = TYPE_FIELDS (elt->type);
> +	      while (field && TREE_CODE (field) != FIELD_DECL)
> +	        field = TREE_CHAIN (field);
> +	    
> +	      if (field && !AGGREGATE_TYPE_P (TREE_TYPE (field)))
> +		{
> +		  field = TREE_CHAIN (field);
> +		  while (field && TREE_CODE (field) != FIELD_DECL)
> +		    field = TREE_CHAIN (field);
> +
> +		  if (field == NULL_TREE)
> +		      use_block_copy = false;
> +		}
> +	    }
> +
>
Why the two loops? wouldn't this simpler version do the same?

if (TREE_CODE (elt->type == RECORD_TYPE)
  for (field = TYPE_FIELDS (elt->type); field; field = TREE_CHAIN (field))
    if (TREE_CODE (field) == FIELD_DECL
        && AGGREGATE_TYPE_P (TREE_TYPE (field)))
      {
        if (num_aggregate++ > 1)
          {
            use_block_copy = false;
            break;
          }
       }


Needs commenting as well.



More information about the Gcc-patches mailing list