Commit 01d8bf07 by Richard Biener Committed by Richard Biener

re PR tree-optimization/56270 (loop over array of struct float causes compiler…

re PR tree-optimization/56270 (loop over array of struct float causes compiler error: segmentation fault)

2013-04-19  Richard Biener  <rguenther@suse.de>

	* tree-vectorizer.h (struct _slp_instance): Move load_permutation
	member ...
	(struct _slp_tree): ... here.  Make it a vector of unsigned ints.
	(SLP_INSTANCE_LOAD_PERMUTATION): Remove.
	(SLP_TREE_LOAD_PERMUTATION): Add.
	(vect_transform_slp_perm_load): Adjust prototype.
	* tree-vect-slp.c (vect_free_slp_tree): Adjust.
	(vect_free_slp_instance): Likewise.
	(vect_create_new_slp_node): Likewise.
	(vect_supported_slp_permutation_p): Remove.
	(vect_slp_rearrange_stmts): Adjust.
	(vect_supported_load_permutation_p): Likewise.  Inline
	vect_supported_slp_permutation_p here.
	(vect_analyze_slp_instance): Compute load permutations per
	slp node instead of per instance.
	(vect_get_slp_defs): Adjust.
	(vect_transform_slp_perm_load): Likewise.
	(vect_schedule_slp_instance): Remove redundant code.
	(vect_schedule_slp): Remove hack for PR56270, add it ...
	* tree-vect-stmts.c (vectorizable_load): ... here, do not
	CSE loads for SLP.  Adjust.

From-SVN: r198095
parent ede22fc3
2013-04-19 Richard Biener <rguenther@suse.de>
* tree-vectorizer.h (struct _slp_instance): Move load_permutation
member ...
(struct _slp_tree): ... here. Make it a vector of unsigned ints.
(SLP_INSTANCE_LOAD_PERMUTATION): Remove.
(SLP_TREE_LOAD_PERMUTATION): Add.
(vect_transform_slp_perm_load): Adjust prototype.
* tree-vect-slp.c (vect_free_slp_tree): Adjust.
(vect_free_slp_instance): Likewise.
(vect_create_new_slp_node): Likewise.
(vect_supported_slp_permutation_p): Remove.
(vect_slp_rearrange_stmts): Adjust.
(vect_supported_load_permutation_p): Likewise. Inline
vect_supported_slp_permutation_p here.
(vect_analyze_slp_instance): Compute load permutations per
slp node instead of per instance.
(vect_get_slp_defs): Adjust.
(vect_transform_slp_perm_load): Likewise.
(vect_schedule_slp_instance): Remove redundant code.
(vect_schedule_slp): Remove hack for PR56270, add it ...
* tree-vect-stmts.c (vectorizable_load): ... here, do not
CSE loads for SLP. Adjust.
2013-04-19 Greta Yorsh <Greta.Yorsh@arm.com>
* config/arm/arm.c (load_multiple_sequence, ldm_stm_operation_p): Fix
......
......@@ -4754,12 +4754,21 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
{
first_stmt = GROUP_FIRST_ELEMENT (stmt_info);
if (slp
&& !SLP_INSTANCE_LOAD_PERMUTATION (slp_node_instance).exists ()
&& !SLP_TREE_LOAD_PERMUTATION (slp_node).exists ()
&& first_stmt != SLP_TREE_SCALAR_STMTS (slp_node)[0])
first_stmt = SLP_TREE_SCALAR_STMTS (slp_node)[0];
/* Check if the chain of loads is already vectorized. */
if (STMT_VINFO_VEC_STMT (vinfo_for_stmt (first_stmt)))
if (STMT_VINFO_VEC_STMT (vinfo_for_stmt (first_stmt))
/* For SLP we would need to copy over SLP_TREE_VEC_STMTS.
??? But we can only do so if there is exactly one
as we have no way to get at the rest. Leave the CSE
opportunity alone.
??? With the group load eventually participating
in multiple different permutations (having multiple
slp nodes which refer to the same group) the CSE
is even wrong code. See PR56270. */
&& !slp)
{
*vec_stmt = STMT_VINFO_VEC_STMT (stmt_info);
return true;
......@@ -4772,7 +4781,7 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
{
grouped_load = false;
vec_num = SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node);
if (SLP_INSTANCE_LOAD_PERMUTATION (slp_node_instance).exists ())
if (SLP_TREE_LOAD_PERMUTATION (slp_node).exists ())
slp_perm = true;
group_gap = GROUP_GAP (vinfo_for_stmt (first_stmt));
}
......@@ -5163,7 +5172,7 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
if (slp_perm)
{
if (!vect_transform_slp_perm_load (stmt, dr_chain, gsi, vf,
if (!vect_transform_slp_perm_load (slp_node, dr_chain, gsi, vf,
slp_node_instance, false))
{
dr_chain.release ();
......
......@@ -106,6 +106,9 @@ struct _slp_tree {
vec<slp_tree> children;
/* A group of scalar stmts to be vectorized together. */
vec<gimple> stmts;
/* Load permutation relative to the stores, NULL if there is no
permutation. */
vec<unsigned> load_permutation;
/* Vectorized stmt/s. */
vec<gimple> vec_stmts;
/* Number of vector stmts that are created to replace the group of scalar
......@@ -131,10 +134,6 @@ typedef struct _slp_instance {
/* Vectorization costs associated with SLP instance. */
stmt_vector_for_cost body_cost_vec;
/* Loads permutation relatively to the stores, NULL if there is no
permutation. */
vec<int> load_permutation;
/* The group of nodes that contain loads of this SLP instance. */
vec<slp_tree> loads;
......@@ -149,7 +148,6 @@ typedef struct _slp_instance {
#define SLP_INSTANCE_GROUP_SIZE(S) (S)->group_size
#define SLP_INSTANCE_UNROLLING_FACTOR(S) (S)->unrolling_factor
#define SLP_INSTANCE_BODY_COST_VEC(S) (S)->body_cost_vec
#define SLP_INSTANCE_LOAD_PERMUTATION(S) (S)->load_permutation
#define SLP_INSTANCE_LOADS(S) (S)->loads
#define SLP_INSTANCE_FIRST_LOAD_STMT(S) (S)->first_load
......@@ -157,6 +155,7 @@ typedef struct _slp_instance {
#define SLP_TREE_SCALAR_STMTS(S) (S)->stmts
#define SLP_TREE_VEC_STMTS(S) (S)->vec_stmts
#define SLP_TREE_NUMBER_OF_VEC_STMTS(S) (S)->vec_stmts_size
#define SLP_TREE_LOAD_PERMUTATION(S) (S)->load_permutation
/* This structure is used in creation of an SLP tree. Each instance
corresponds to the same operand in a group of scalar stmts in an SLP
......@@ -961,7 +960,7 @@ extern int vect_get_single_scalar_iteration_cost (loop_vec_info);
/* In tree-vect-slp.c. */
extern void vect_free_slp_instance (slp_instance);
extern bool vect_transform_slp_perm_load (gimple, vec<tree> ,
extern bool vect_transform_slp_perm_load (slp_tree, vec<tree> ,
gimple_stmt_iterator *, int,
slp_instance, bool);
extern bool vect_schedule_slp (loop_vec_info, bb_vec_info);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment