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 PR82255 (vectorizer cost model overcounts some vector load costs)


Bill Schmidt <wschmidt@linux.vnet.ibm.com> writes:
> Index: gcc/tree-vect-stmts.c
> ===================================================================
> --- gcc/tree-vect-stmts.c	(revision 252760)
> +++ gcc/tree-vect-stmts.c	(working copy)
> @@ -1091,8 +1091,19 @@ vect_model_load_cost (stmt_vec_info stmt_info, int
>  			prologue_cost_vec, body_cost_vec, true);
>    if (memory_access_type == VMAT_ELEMENTWISE
>        || memory_access_type == VMAT_STRIDED_SLP)
> -    inside_cost += record_stmt_cost (body_cost_vec, ncopies, vec_construct,
> -				     stmt_info, 0, vect_body);
> +    {
> +      int group_size = GROUP_SIZE (stmt_info);
> +      int nunits = TYPE_VECTOR_SUBPARTS (STMT_VINFO_VECTYPE (stmt_info));
> +      if (group_size < nunits)
> +	{
> +	  if (dump_enabled_p ())
> +	    dump_printf_loc (MSG_NOTE, vect_location,
> +			     "vect_model_load_cost: vec_construct required");
> +	  inside_cost += record_stmt_cost (body_cost_vec, ncopies,
> +					   vec_construct, stmt_info, 0,
> +					   vect_body);
> +	}
> +    }
>  
>    if (dump_enabled_p ())
>      dump_printf_loc (MSG_NOTE, vect_location,

This feels like we've probably got the wrong memory_access_type.
If it's a just a contiguous load then it should be VMAT_CONTIGUOUS
instead.

Thanks,
Richard



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