Commit 211ee39b by Richard Sandiford Committed by Richard Sandiford

[24/46] Make stmt_info_for_cost use a stmt_vec_info

This patch makes stmt_info_for_cost carry a stmt_vec_info instead
of a gimple stmt.  The structure is internal to the vectoriser,
so targets aren't affected.

2018-07-31  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* tree-vectorizer.h (stmt_info_for_cost::stmt): Replace with...
	(stmt_info_for_cost::stmt_info): ...this new field.
	(add_stmt_costs): Update accordingly.
	* tree-vect-loop.c (vect_compute_single_scalar_iteration_cost)
	(vect_get_known_peeling_cost): Likewise.
	(vect_estimate_min_profitable_iters): Likewise.
	* tree-vect-stmts.c (record_stmt_cost): Likewise.

From-SVN: r263139
parent 7bcbf2d8
2018-07-31 Richard Sandiford <richard.sandiford@arm.com> 2018-07-31 Richard Sandiford <richard.sandiford@arm.com>
* tree-vectorizer.h (stmt_info_for_cost::stmt): Replace with...
(stmt_info_for_cost::stmt_info): ...this new field.
(add_stmt_costs): Update accordingly.
* tree-vect-loop.c (vect_compute_single_scalar_iteration_cost)
(vect_get_known_peeling_cost): Likewise.
(vect_estimate_min_profitable_iters): Likewise.
* tree-vect-stmts.c (record_stmt_cost): Likewise.
2018-07-31 Richard Sandiford <richard.sandiford@arm.com>
* tree-vectorizer.h (_loop_vec_info::may_misalign_stmts): Change * tree-vectorizer.h (_loop_vec_info::may_misalign_stmts): Change
from an auto_vec<gimple *> to an auto_vec<stmt_vec_info>. from an auto_vec<gimple *> to an auto_vec<stmt_vec_info>.
* tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Update * tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Update
......
...@@ -1136,13 +1136,9 @@ vect_compute_single_scalar_iteration_cost (loop_vec_info loop_vinfo) ...@@ -1136,13 +1136,9 @@ vect_compute_single_scalar_iteration_cost (loop_vec_info loop_vinfo)
int j; int j;
FOR_EACH_VEC_ELT (LOOP_VINFO_SCALAR_ITERATION_COST (loop_vinfo), FOR_EACH_VEC_ELT (LOOP_VINFO_SCALAR_ITERATION_COST (loop_vinfo),
j, si) j, si)
{ (void) add_stmt_cost (target_cost_data, si->count,
struct _stmt_vec_info *stmt_info si->kind, si->stmt_info, si->misalign,
= si->stmt ? vinfo_for_stmt (si->stmt) : NULL_STMT_VEC_INFO; vect_body);
(void) add_stmt_cost (target_cost_data, si->count,
si->kind, stmt_info, si->misalign,
vect_body);
}
unsigned dummy, body_cost = 0; unsigned dummy, body_cost = 0;
finish_cost (target_cost_data, &dummy, &body_cost, &dummy); finish_cost (target_cost_data, &dummy, &body_cost, &dummy);
destroy_cost_data (target_cost_data); destroy_cost_data (target_cost_data);
...@@ -3344,24 +3340,16 @@ vect_get_known_peeling_cost (loop_vec_info loop_vinfo, int peel_iters_prologue, ...@@ -3344,24 +3340,16 @@ vect_get_known_peeling_cost (loop_vec_info loop_vinfo, int peel_iters_prologue,
int j; int j;
if (peel_iters_prologue) if (peel_iters_prologue)
FOR_EACH_VEC_ELT (*scalar_cost_vec, j, si) FOR_EACH_VEC_ELT (*scalar_cost_vec, j, si)
{ retval += record_stmt_cost (prologue_cost_vec,
stmt_vec_info stmt_info si->count * peel_iters_prologue,
= si->stmt ? vinfo_for_stmt (si->stmt) : NULL_STMT_VEC_INFO; si->kind, si->stmt_info, si->misalign,
retval += record_stmt_cost (prologue_cost_vec, vect_prologue);
si->count * peel_iters_prologue,
si->kind, stmt_info, si->misalign,
vect_prologue);
}
if (*peel_iters_epilogue) if (*peel_iters_epilogue)
FOR_EACH_VEC_ELT (*scalar_cost_vec, j, si) FOR_EACH_VEC_ELT (*scalar_cost_vec, j, si)
{ retval += record_stmt_cost (epilogue_cost_vec,
stmt_vec_info stmt_info si->count * *peel_iters_epilogue,
= si->stmt ? vinfo_for_stmt (si->stmt) : NULL_STMT_VEC_INFO; si->kind, si->stmt_info, si->misalign,
retval += record_stmt_cost (epilogue_cost_vec, vect_epilogue);
si->count * *peel_iters_epilogue,
si->kind, stmt_info, si->misalign,
vect_epilogue);
}
return retval; return retval;
} }
...@@ -3497,13 +3485,9 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo, ...@@ -3497,13 +3485,9 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo,
int j; int j;
FOR_EACH_VEC_ELT (LOOP_VINFO_SCALAR_ITERATION_COST (loop_vinfo), FOR_EACH_VEC_ELT (LOOP_VINFO_SCALAR_ITERATION_COST (loop_vinfo),
j, si) j, si)
{ (void) add_stmt_cost (target_cost_data, si->count,
struct _stmt_vec_info *stmt_info si->kind, si->stmt_info, si->misalign,
= si->stmt ? vinfo_for_stmt (si->stmt) : NULL_STMT_VEC_INFO; vect_epilogue);
(void) add_stmt_cost (target_cost_data, si->count,
si->kind, stmt_info, si->misalign,
vect_epilogue);
}
} }
} }
else if (npeel < 0) else if (npeel < 0)
...@@ -3535,15 +3519,13 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo, ...@@ -3535,15 +3519,13 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo,
int j; int j;
FOR_EACH_VEC_ELT (LOOP_VINFO_SCALAR_ITERATION_COST (loop_vinfo), j, si) FOR_EACH_VEC_ELT (LOOP_VINFO_SCALAR_ITERATION_COST (loop_vinfo), j, si)
{ {
struct _stmt_vec_info *stmt_info
= si->stmt ? vinfo_for_stmt (si->stmt) : NULL_STMT_VEC_INFO;
(void) add_stmt_cost (target_cost_data, (void) add_stmt_cost (target_cost_data,
si->count * peel_iters_prologue, si->count * peel_iters_prologue,
si->kind, stmt_info, si->misalign, si->kind, si->stmt_info, si->misalign,
vect_prologue); vect_prologue);
(void) add_stmt_cost (target_cost_data, (void) add_stmt_cost (target_cost_data,
si->count * peel_iters_epilogue, si->count * peel_iters_epilogue,
si->kind, stmt_info, si->misalign, si->kind, si->stmt_info, si->misalign,
vect_epilogue); vect_epilogue);
} }
} }
...@@ -3566,20 +3548,12 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo, ...@@ -3566,20 +3548,12 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo,
&epilogue_cost_vec); &epilogue_cost_vec);
FOR_EACH_VEC_ELT (prologue_cost_vec, j, si) FOR_EACH_VEC_ELT (prologue_cost_vec, j, si)
{ (void) add_stmt_cost (data, si->count, si->kind, si->stmt_info,
struct _stmt_vec_info *stmt_info si->misalign, vect_prologue);
= si->stmt ? vinfo_for_stmt (si->stmt) : NULL_STMT_VEC_INFO;
(void) add_stmt_cost (data, si->count, si->kind, stmt_info,
si->misalign, vect_prologue);
}
FOR_EACH_VEC_ELT (epilogue_cost_vec, j, si) FOR_EACH_VEC_ELT (epilogue_cost_vec, j, si)
{ (void) add_stmt_cost (data, si->count, si->kind, si->stmt_info,
struct _stmt_vec_info *stmt_info si->misalign, vect_epilogue);
= si->stmt ? vinfo_for_stmt (si->stmt) : NULL_STMT_VEC_INFO;
(void) add_stmt_cost (data, si->count, si->kind, stmt_info,
si->misalign, vect_epilogue);
}
prologue_cost_vec.release (); prologue_cost_vec.release ();
epilogue_cost_vec.release (); epilogue_cost_vec.release ();
......
...@@ -98,9 +98,7 @@ record_stmt_cost (stmt_vector_for_cost *body_cost_vec, int count, ...@@ -98,9 +98,7 @@ record_stmt_cost (stmt_vector_for_cost *body_cost_vec, int count,
&& STMT_VINFO_GATHER_SCATTER_P (stmt_info)) && STMT_VINFO_GATHER_SCATTER_P (stmt_info))
kind = vector_scatter_store; kind = vector_scatter_store;
stmt_info_for_cost si = { count, kind, where, stmt_info_for_cost si = { count, kind, where, stmt_info, misalign };
stmt_info ? STMT_VINFO_STMT (stmt_info) : NULL,
misalign };
body_cost_vec->safe_push (si); body_cost_vec->safe_push (si);
tree vectype = stmt_info ? stmt_vectype (stmt_info) : NULL_TREE; tree vectype = stmt_info ? stmt_vectype (stmt_info) : NULL_TREE;
......
...@@ -116,7 +116,7 @@ struct stmt_info_for_cost { ...@@ -116,7 +116,7 @@ struct stmt_info_for_cost {
int count; int count;
enum vect_cost_for_stmt kind; enum vect_cost_for_stmt kind;
enum vect_cost_model_location where; enum vect_cost_model_location where;
gimple *stmt; stmt_vec_info stmt_info;
int misalign; int misalign;
}; };
...@@ -1282,10 +1282,7 @@ add_stmt_costs (void *data, stmt_vector_for_cost *cost_vec) ...@@ -1282,10 +1282,7 @@ add_stmt_costs (void *data, stmt_vector_for_cost *cost_vec)
stmt_info_for_cost *cost; stmt_info_for_cost *cost;
unsigned i; unsigned i;
FOR_EACH_VEC_ELT (*cost_vec, i, cost) FOR_EACH_VEC_ELT (*cost_vec, i, cost)
add_stmt_cost (data, cost->count, cost->kind, add_stmt_cost (data, cost->count, cost->kind, cost->stmt_info,
(cost->stmt
? vinfo_for_stmt (cost->stmt)
: NULL_STMT_VEC_INFO),
cost->misalign, cost->where); cost->misalign, cost->where);
} }
......
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