This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]