[patch] Loop-aware SLP 4/5

Dorit Nuzman DORIT@il.ibm.com
Sun Sep 9 11:54:00 GMT 2007


Ira Rosen/Haifa/IBM wrote on 09/09/2007 13:54:30:

> Dorit Nuzman/Haifa/IBM wrote on 09/09/2007 11:00:13:
>
> > Ira Rosen/Haifa/IBM wrote on 09/09/2007 10:12:40:
> >
> > > Dorit Nuzman/Haifa/IBM wrote on 18/08/2007 21:36:27:
> > >
> > > > Ira Rosen/Haifa/IBM wrote on 14/08/2007 16:15:19:
> > > >
> > > > and lastly, about the following repeating change:
> > > >
> > > > +  int *inside_cost_field, *outside_cost_field;
> > > > +
> > > > +  /* Take addresses of relevant fields to update in the function.
*/
> > > > +  if (slp_node)
> > > > +    {
> > > > +      inside_cost_field = &(SLP_TREE_INSIDE_OF_LOOP_COST
(slp_node));
> > > > +      outside_cost_field = &(SLP_TREE_OUTSIDE_OF_LOOP_COST
(slp_node));
> > > > +    }
> > > > +  else
> > > > +    {
> > > > +      inside_cost_field = &(STMT_VINFO_INSIDE_OF_LOOP_COST
> (stmt_info));
> > > > +      outside_cost_field = &(STMT_VINFO_OUTSIDE_OF_LOOP_COST
> > (stmt_info));
> > > > +    }
> > > > ...
> > > > -        STMT_VINFO_OUTSIDE_OF_LOOP_COST (stmt_info) = outer_cost;
> > > > +        *outside_cost_field = outer_cost;
> > > >
> > > >          inner_cost += ncopies * (TARG_VEC_LOAD_COST +
> > TARG_VEC_STMT_COST);
> > > >
> > > > @@ -607,12 +654,12 @@ vect_model_load_cost (stmt_vec_info stmt
> > > >        gcc_unreachable ();
> > > >      }
> > > >
> > > > -  STMT_VINFO_INSIDE_OF_LOOP_COST (stmt_info) = inner_cost;
> > > > +  *inside_cost_field = inner_cost;
> > > >
> > > > Again, in an attempt to reduce "if (slp_node)" switches in the
code,
> > > > I'd replace
> > > >  STMT_VINFO_INSIDE_OF_LOOP_COST (stmt_info) = cost;
> > > >  STMT_VINFO_OUTSIDE_OF_LOOP_COST (stmt_info) = cost;
> > > > with
> > > >  stmt_vinfo_inside_of_loop_cost (stmt_info, slp_node, cost);
> > > >  stmt_vinfo_outside_of_loop_cost (stmt_info, slp_node, cost);
> > > >
> > > > ...and hide the "if (slp_node)" switch there:
> > > >  stmt_vinfo_inside_of_loop_cost (stmt_info, slp_node, cost)
> > > >    {
> > > >      if (slp_node)
> > > >   SLP_TREE_INSIDE_OF_LOOP_COST (slp_node) = cost;
> > > >      else
> > > >   STMT_VINFO_INSIDE_OF_LOOP_COST (stmt_info) = cost;
> > > >    }
> > > >
> > > > (for your consideration...)
> > >
> > > I moved the choice of the relevant field to a different
> (inlined) function.
> > >
> >
> > I prefer the alternative I suggested above - it's a bit less code
> > (no need for the call to the selection function) and more
> > importantly the whole field selection machinery is entirely hidden.
> > Please consider changing (or explain why you prefer the other
solution).
> >
> > In the meantime, ok to commit this patch and all the other parts as
> > well (the above change can be applied separately later).
>
> Here is the patch.
> Bootstrapped and tested on x86_64-linux.
> OK for mainline?
>

yes

thanks,
dorit

> Thanks,
> Ira
>
> ChangeLog:
>
>  * tree-vectorizer.h (stmt_vinfo_set_inside_of_loop_cost,
>  stmt_vinfo_set_outside_of_loop_cost): New functions.
>  * tree-vect-transform.c (vect_get_cost_fields): Remove.
>  (vect_model_simple_cost): Call
stmt_vinfo_set_inside/outside_of_loop_cost
>  to set the relevant cost field instead of calling vect_get_cost_fields.
>  (vect_model_store_cost, vect_model_load_cost): Likewise.
>
> [attachment "costs.txt" deleted by Dorit Nuzman/Haifa/IBM]



More information about the Gcc-patches mailing list