Message ID | 20160115114658.GB12414@msticlxl57.ims.intel.com |
---|---|
State | New |
Headers | show |
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. 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 > > commit 4383b8f528f0b5e2ea3366b51c4c76d29cf7a416 > Author: Kirill Yukhin <kirill.yukhin@intel.com> > Date: Fri Jan 15 14:07:59 2016 +0300 > > Fix ICE in vectorizable_store (). > > diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c > index 872fa07..7e44601 100644 > --- a/gcc/tree-vect-stmts.c > +++ b/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); > > >
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 872fa07..7e44601 100644 --- a/gcc/tree-vect-stmts.c +++ b/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);