On Tue, 19 Jan 2016, Kirill Yukhin wrote:

> Hello Richard,
> On 15 Jan 12:54, Richard Biener wrote:
> > On Fri, 15 Jan 2016, Kirill Yukhin wrote:
> > 
> > > Hello,
> > > Thet patch in the bottom adds check if rhs is "useless_type_conversion_p"
> > > in vectorizable_store () to avoid subsequent gcc_assert.
> > > 
> > > This change is very similar to [1].
> > > 
> > > Bootstrapped & regtest in progress.
> > > 
> > > Is it ok for main trunk if regtest pass?
> > 
> > Ok, but please add a testcase that is fixed.
> I've updated the patch to allow RHSes w/o vectypes (like from built-ins)
> And now bootstrap & regtest show no issues.
> 
> Unfortunatelly, this issue arised on huge Fortran workload (POP2)
> only w/ LTO and I was unable to extract a case from it (spent few hours 
> though).
> 
> So, may be this patch is acceptable w/o reg test?

Ok.

Thanks,
Richard.

> --
> Thanks, K
> 
> > 
> > Thanks,
> > Richard.
> > 
> > > gcc/
> > >   * tree-vect-stmts.c (vectorizable_store): Check
> > >   rhs vectype.
> > > 
> > > 
> > > [1] - https://gcc.gnu.org/ml/gcc-patches/2015-11/msg01551.html
> > > 
> > > --
> > > Thanks, K
> > > 
> 
> diff --git b/gcc/tree-vect-stmts.c a/gcc/tree-vect-stmts.c
> index 872fa07..2aaa335 100644
> --- b/gcc/tree-vect-stmts.c
> +++ a/gcc/tree-vect-stmts.c
> @@ -5282,7 +5282,7 @@ vectorizable_store (gimple *stmt, gimple_stmt_iterator 
> *gsi, gimple **vec_stmt,
>  
>    gcc_assert (gimple_assign_single_p (stmt));
>  
> -  tree vectype = STMT_VINFO_VECTYPE (stmt_info);
> +  tree vectype = STMT_VINFO_VECTYPE (stmt_info), rhs_vectype = NULL_TREE;
>    unsigned int nunits = TYPE_VECTOR_SUBPARTS (vectype);
>  
>    if (loop_vinfo)
> @@ -5308,7 +5308,8 @@ vectorizable_store (gimple *stmt, gimple_stmt_iterator 
> *gsi, gimple **vec_stmt,
>      }
>  
>    op = gimple_assign_rhs1 (stmt);
> -  if (!vect_is_simple_use (op, vinfo, &def_stmt, &dt))
> +
> +  if (!vect_is_simple_use (op, vinfo, &def_stmt, &dt, &rhs_vectype))
>      {
>        if (dump_enabled_p ())
>          dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
> @@ -5316,6 +5317,9 @@ vectorizable_store (gimple *stmt, gimple_stmt_iterator 
> *gsi, gimple **vec_stmt,
>        return false;
>      }
>  
> +  if (rhs_vectype && !useless_type_conversion_p (vectype, rhs_vectype))
> +    return false;
> +
>    elem_type = TREE_TYPE (vectype);
>    vec_mode = TYPE_MODE (vectype);
>  
> 
> 

-- 
Richard Biener <rguent...@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 
21284 (AG Nuernberg)

Reply via email to