Tidy dr_chain allocation in vectorizable_load
Richard Sandiford
richard.sandiford@linaro.org
Tue Apr 12 13:10:00 GMT 2011
vectorizable_load allocates n_copies+1 dr_chains, even though only
the first n_copies are needed. This patch removes the extra one and
IMO makes the flow a bit more obvious.
Tested on x86_64-linux-gnu and arm-linux-gnueabi. OK to install?
Richard
gcc/
* tree-vect-stmts.c (vectorizable_load): Allocate and free dr_chain
within the per-copy loop.
Index: gcc/tree-vect-stmts.c
===================================================================
--- gcc/tree-vect-stmts.c 2011-04-12 11:55:07.000000000 +0100
+++ gcc/tree-vect-stmts.c 2011-04-12 11:55:08.000000000 +0100
@@ -3961,8 +3961,6 @@ vectorizable_load (gimple stmt, gimple_s
}
else
vec_num = group_size;
-
- dr_chain = VEC_alloc (tree, heap, vec_num);
}
else
{
@@ -4116,6 +4114,9 @@ vectorizable_load (gimple stmt, gimple_s
dataref_ptr =
bump_vector_ptr (dataref_ptr, ptr_incr, gsi, stmt, NULL_TREE);
+ if (strided_load || slp_perm)
+ dr_chain = VEC_alloc (tree, heap, vec_num);
+
for (i = 0; i < vec_num; i++)
{
if (i > 0)
@@ -4325,8 +4326,6 @@ vectorizable_load (gimple stmt, gimple_s
return false;
*vec_stmt = STMT_VINFO_VEC_STMT (stmt_info);
- VEC_free (tree, heap, dr_chain);
- dr_chain = VEC_alloc (tree, heap, group_size);
}
else
{
@@ -4337,11 +4336,10 @@ vectorizable_load (gimple stmt, gimple_s
prev_stmt_info = vinfo_for_stmt (new_stmt);
}
}
+ if (dr_chain)
+ VEC_free (tree, heap, dr_chain);
}
- if (dr_chain)
- VEC_free (tree, heap, dr_chain);
-
return true;
}
More information about the Gcc-patches
mailing list