This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR tree-opt/25500 SRA vs struct containing a vector
- From: Diego Novillo <dnovillo at redhat dot com>
- To: Andrew_Pinski at PlayStation dot Sony dot Com
- Cc: gcc-patches at gcc dot gnu dot org, mark at codesourcery dot com, paolo dot bonzini at lu dot unisi dot ch
- Date: Wed, 15 Nov 2006 08:40:01 -0500
- Subject: Re: [PATCH] Fix PR tree-opt/25500 SRA vs struct containing a vector
- References: <OFE6A6AB3D.47DD02C6-ON88257227.0001D97B-88257227.00035959@playstation.sony.com>
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.