This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix tuplification of vectorizable_call
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 4 Aug 2008 17:58:47 +0200 (CEST)
- Subject: [PATCH] Fix tuplification of vectorizable_call
The iteration variable changed but not the argument to vect_is_simple_use
... which leads to interesting segfaults.
I'll bootstrap & test this and install it.
Richard.
2008-08-04 Richard Guenther <rguenther@suse.de>
* tree-vect-transform.c (vectorizable_call): Fix tuplification.
Index: gcc/tree-vect-transform.c
===================================================================
*** gcc/tree-vect-transform.c (revision 138611)
--- gcc/tree-vect-transform.c (working copy)
*************** vectorizable_call (gimple stmt, gimple_s
*** 3127,3142 ****
rhs_type = NULL_TREE;
nargs = gimple_call_num_args (stmt);
for (i = 0; i < nargs; i++)
{
op = gimple_call_arg (stmt, i);
- /* Bail out if the function has more than two arguments, we
- do not have interesting builtin functions to vectorize with
- more than two arguments. */
- if (i >= 2)
- return false;
-
/* We can only handle calls with arguments of the same type. */
if (rhs_type
&& rhs_type != TREE_TYPE (op))
--- 3127,3142 ----
rhs_type = NULL_TREE;
nargs = gimple_call_num_args (stmt);
+ /* Bail out if the function has more than two arguments, we
+ do not have interesting builtin functions to vectorize with
+ more than two arguments. No arguments is also not good. */
+ if (nargs == 0 || nargs > 2)
+ return false;
+
for (i = 0; i < nargs; i++)
{
op = gimple_call_arg (stmt, i);
/* We can only handle calls with arguments of the same type. */
if (rhs_type
&& rhs_type != TREE_TYPE (op))
*************** vectorizable_call (gimple stmt, gimple_s
*** 3147,3153 ****
}
rhs_type = TREE_TYPE (op);
! if (!vect_is_simple_use (op, loop_vinfo, &def_stmt, &def, &dt[nargs]))
{
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "use not simple.");
--- 3147,3153 ----
}
rhs_type = TREE_TYPE (op);
! if (!vect_is_simple_use (op, loop_vinfo, &def_stmt, &def, &dt[i]))
{
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "use not simple.");
*************** vectorizable_call (gimple stmt, gimple_s
*** 3155,3164 ****
}
}
- /* No arguments is also not good. */
- if (nargs == 0)
- return false;
-
vectype_in = get_vectype_for_scalar_type (rhs_type);
if (!vectype_in)
return false;
--- 3155,3160 ----