From: Richard Sandiford <richard.sandiford@arm.com>
To: gcc-patches@gcc.gnu.org
Subject: [16/46] Make STMT_VINFO_REDUC_DEF a stmt_vec_info
Date: Tue, 24 Jul 2018 09:59:00 -0000 [thread overview]
Message-ID: <87zhyhosxy.fsf@arm.com> (raw)
In-Reply-To: <87wotlrmen.fsf@arm.com> (Richard Sandiford's message of "Tue, 24 Jul 2018 10:52:16 +0100")
This patch changes STMT_VINFO_REDUC_DEF from a gimple stmt to a
stmt_vec_info.
2018-07-24 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* tree-vectorizer.h (_stmt_vec_info::reduc_def): Change from
a gimple stmt to a stmt_vec_info.
* tree-vect-loop.c (vect_active_double_reduction_p)
(vect_force_simple_reduction, vectorizable_reduction): Update
accordingly.
Index: gcc/tree-vectorizer.h
===================================================================
--- gcc/tree-vectorizer.h 2018-07-24 10:22:50.777128110 +0100
+++ gcc/tree-vectorizer.h 2018-07-24 10:22:53.909100298 +0100
@@ -921,7 +921,7 @@ struct _stmt_vec_info {
/* On a reduction PHI the def returned by vect_force_simple_reduction.
On the def returned by vect_force_simple_reduction the
corresponding PHI. */
- gimple *reduc_def;
+ stmt_vec_info reduc_def;
/* The number of scalar stmt references from active SLP instances. */
unsigned int num_slp_uses;
Index: gcc/tree-vect-loop.c
===================================================================
--- gcc/tree-vect-loop.c 2018-07-24 10:22:50.777128110 +0100
+++ gcc/tree-vect-loop.c 2018-07-24 10:22:53.909100298 +0100
@@ -1499,8 +1499,7 @@ vect_active_double_reduction_p (stmt_vec
if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_double_reduction_def)
return false;
- gimple *other_phi = STMT_VINFO_REDUC_DEF (stmt_info);
- return STMT_VINFO_RELEVANT_P (vinfo_for_stmt (other_phi));
+ return STMT_VINFO_RELEVANT_P (STMT_VINFO_REDUC_DEF (stmt_info));
}
/* Function vect_analyze_loop_operations.
@@ -3293,12 +3292,12 @@ vect_force_simple_reduction (loop_vec_in
&v_reduc_type);
if (def)
{
- stmt_vec_info reduc_def_info = vinfo_for_stmt (phi);
- STMT_VINFO_REDUC_TYPE (reduc_def_info) = v_reduc_type;
- STMT_VINFO_REDUC_DEF (reduc_def_info) = def;
- reduc_def_info = vinfo_for_stmt (def);
- STMT_VINFO_REDUC_TYPE (reduc_def_info) = v_reduc_type;
- STMT_VINFO_REDUC_DEF (reduc_def_info) = phi;
+ stmt_vec_info phi_info = vinfo_for_stmt (phi);
+ stmt_vec_info def_info = vinfo_for_stmt (def);
+ STMT_VINFO_REDUC_TYPE (phi_info) = v_reduc_type;
+ STMT_VINFO_REDUC_DEF (phi_info) = def_info;
+ STMT_VINFO_REDUC_TYPE (def_info) = v_reduc_type;
+ STMT_VINFO_REDUC_DEF (def_info) = phi_info;
}
return def;
}
@@ -6153,17 +6152,16 @@ vectorizable_reduction (gimple *stmt, gi
for reductions involving a single statement. */
return true;
- gimple *reduc_stmt = STMT_VINFO_REDUC_DEF (stmt_info);
- if (STMT_VINFO_IN_PATTERN_P (vinfo_for_stmt (reduc_stmt)))
- reduc_stmt = STMT_VINFO_RELATED_STMT (vinfo_for_stmt (reduc_stmt));
+ stmt_vec_info reduc_stmt_info = STMT_VINFO_REDUC_DEF (stmt_info);
+ if (STMT_VINFO_IN_PATTERN_P (reduc_stmt_info))
+ reduc_stmt_info = STMT_VINFO_RELATED_STMT (reduc_stmt_info);
- stmt_vec_info reduc_stmt_info = vinfo_for_stmt (reduc_stmt);
if (STMT_VINFO_VEC_REDUCTION_TYPE (reduc_stmt_info)
== EXTRACT_LAST_REDUCTION)
/* Leave the scalar phi in place. */
return true;
- gcc_assert (is_gimple_assign (reduc_stmt));
+ gassign *reduc_stmt = as_a <gassign *> (reduc_stmt_info->stmt);
for (unsigned k = 1; k < gimple_num_ops (reduc_stmt); ++k)
{
tree op = gimple_op (reduc_stmt, k);
@@ -6314,7 +6312,7 @@ vectorizable_reduction (gimple *stmt, gi
The last use is the reduction variable. In case of nested cycle this
assumption is not true: we use reduc_index to record the index of the
reduction variable. */
- gimple *reduc_def_stmt = NULL;
+ stmt_vec_info reduc_def_info = NULL;
int reduc_index = -1;
for (i = 0; i < op_type; i++)
{
@@ -6329,7 +6327,7 @@ vectorizable_reduction (gimple *stmt, gi
gcc_assert (is_simple_use);
if (dt == vect_reduction_def)
{
- reduc_def_stmt = def_stmt_info;
+ reduc_def_info = def_stmt_info;
reduc_index = i;
continue;
}
@@ -6353,7 +6351,7 @@ vectorizable_reduction (gimple *stmt, gi
if (dt == vect_nested_cycle)
{
found_nested_cycle_def = true;
- reduc_def_stmt = def_stmt_info;
+ reduc_def_info = def_stmt_info;
reduc_index = i;
}
@@ -6391,12 +6389,16 @@ vectorizable_reduction (gimple *stmt, gi
}
if (orig_stmt_info)
- reduc_def_stmt = STMT_VINFO_REDUC_DEF (orig_stmt_info);
+ reduc_def_info = STMT_VINFO_REDUC_DEF (orig_stmt_info);
else
- reduc_def_stmt = STMT_VINFO_REDUC_DEF (stmt_info);
+ reduc_def_info = STMT_VINFO_REDUC_DEF (stmt_info);
}
- if (! reduc_def_stmt || gimple_code (reduc_def_stmt) != GIMPLE_PHI)
+ if (! reduc_def_info)
+ return false;
+
+ gphi *reduc_def_phi = dyn_cast <gphi *> (reduc_def_info->stmt);
+ if (!reduc_def_phi)
return false;
if (!(reduc_index == -1
@@ -6415,12 +6417,11 @@ vectorizable_reduction (gimple *stmt, gi
return false;
}
- stmt_vec_info reduc_def_info = vinfo_for_stmt (reduc_def_stmt);
/* PHIs should not participate in patterns. */
gcc_assert (!STMT_VINFO_RELATED_STMT (reduc_def_info));
enum vect_reduction_type v_reduc_type
= STMT_VINFO_REDUC_TYPE (reduc_def_info);
- gimple *tmp = STMT_VINFO_REDUC_DEF (reduc_def_info);
+ stmt_vec_info tmp = STMT_VINFO_REDUC_DEF (reduc_def_info);
STMT_VINFO_VEC_REDUCTION_TYPE (stmt_info) = v_reduc_type;
/* If we have a condition reduction, see if we can simplify it further. */
@@ -6547,15 +6548,14 @@ vectorizable_reduction (gimple *stmt, gi
if (orig_stmt_info)
gcc_assert (tmp == orig_stmt_info
- || (REDUC_GROUP_FIRST_ELEMENT (vinfo_for_stmt (tmp))
- == orig_stmt_info));
+ || REDUC_GROUP_FIRST_ELEMENT (tmp) == orig_stmt_info);
else
/* We changed STMT to be the first stmt in reduction chain, hence we
check that in this case the first element in the chain is STMT. */
- gcc_assert (stmt == tmp
- || REDUC_GROUP_FIRST_ELEMENT (vinfo_for_stmt (tmp)) == stmt);
+ gcc_assert (tmp == stmt_info
+ || REDUC_GROUP_FIRST_ELEMENT (tmp) == stmt_info);
- if (STMT_VINFO_LIVE_P (vinfo_for_stmt (reduc_def_stmt)))
+ if (STMT_VINFO_LIVE_P (reduc_def_info))
return false;
if (slp_node)
@@ -6702,9 +6702,9 @@ vectorizable_reduction (gimple *stmt, gi
if (nested_cycle)
{
- def_bb = gimple_bb (reduc_def_stmt);
+ def_bb = gimple_bb (reduc_def_phi);
def_stmt_loop = def_bb->loop_father;
- def_arg = PHI_ARG_DEF_FROM_EDGE (reduc_def_stmt,
+ def_arg = PHI_ARG_DEF_FROM_EDGE (reduc_def_phi,
loop_preheader_edge (def_stmt_loop));
stmt_vec_info def_arg_stmt_info = loop_vinfo->lookup_def (def_arg);
if (def_arg_stmt_info
@@ -6954,7 +6954,7 @@ vectorizable_reduction (gimple *stmt, gi
in vectorizable_reduction and there are no intermediate stmts
participating. */
stmt_vec_info use_stmt_info;
- tree reduc_phi_result = gimple_phi_result (reduc_def_stmt);
+ tree reduc_phi_result = gimple_phi_result (reduc_def_phi);
if (ncopies > 1
&& (STMT_VINFO_RELEVANT (stmt_info) <= vect_used_only_live)
&& (use_stmt_info = loop_vinfo->lookup_single_use (reduc_phi_result))
@@ -7039,7 +7039,7 @@ vectorizable_reduction (gimple *stmt, gi
if (reduction_type == FOLD_LEFT_REDUCTION)
return vectorize_fold_left_reduction
- (stmt, gsi, vec_stmt, slp_node, reduc_def_stmt, code,
+ (stmt, gsi, vec_stmt, slp_node, reduc_def_phi, code,
reduc_fn, ops, vectype_in, reduc_index, masks);
if (reduction_type == EXTRACT_LAST_REDUCTION)
@@ -7070,7 +7070,7 @@ vectorizable_reduction (gimple *stmt, gi
if (slp_node)
phis.splice (SLP_TREE_VEC_STMTS (slp_node_instance->reduc_phis));
else
- phis.quick_push (STMT_VINFO_VEC_STMT (vinfo_for_stmt (reduc_def_stmt)));
+ phis.quick_push (STMT_VINFO_VEC_STMT (reduc_def_info));
for (j = 0; j < ncopies; j++)
{
@@ -7208,7 +7208,7 @@ vectorizable_reduction (gimple *stmt, gi
if ((!single_defuse_cycle || code == COND_EXPR) && !slp_node)
vect_defs[0] = gimple_get_lhs ((*vec_stmt)->stmt);
- vect_create_epilog_for_reduction (vect_defs, stmt, reduc_def_stmt,
+ vect_create_epilog_for_reduction (vect_defs, stmt, reduc_def_phi,
epilog_copies, reduc_fn, phis,
double_reduc, slp_node, slp_node_instance,
cond_reduc_val, cond_reduc_op_code,
next prev parent reply other threads:[~2018-07-24 9:59 UTC|newest]
Thread overview: 108+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-24 9:52 [00/46] Remove vinfo_for_stmt etc Richard Sandiford
2018-07-24 9:52 ` [01/46] Move special cases out of get_initial_def_for_reduction Richard Sandiford
2018-07-25 8:42 ` Richard Biener
2018-07-24 9:53 ` [03/46] Remove unnecessary update of NUM_SLP_USES Richard Sandiford
2018-07-25 8:46 ` Richard Biener
2018-07-24 9:53 ` [02/46] Remove dead vectorizable_reduction code Richard Sandiford
2018-07-25 8:43 ` Richard Biener
2018-07-24 9:54 ` [05/46] Fix make_ssa_name call in vectorizable_reduction Richard Sandiford
2018-07-25 8:47 ` Richard Biener
2018-07-24 9:54 ` [04/46] Factor out the test for a valid reduction input Richard Sandiford
2018-07-25 8:46 ` Richard Biener
2018-07-24 9:55 ` [08/46] Add vec_info::lookup_def Richard Sandiford
2018-07-25 9:12 ` Richard Biener
2018-07-24 9:55 ` [06/46] Add vec_info::add_stmt Richard Sandiford
2018-07-25 9:10 ` Richard Biener
2018-07-24 9:55 ` [07/46] Add vec_info::lookup_stmt Richard Sandiford
2018-07-25 9:11 ` Richard Biener
2018-07-24 9:56 ` [09/46] Add vec_info::lookup_single_use Richard Sandiford
2018-07-25 9:13 ` Richard Biener
2018-07-24 9:57 ` [10/46] Temporarily make stmt_vec_info a class Richard Sandiford
2018-07-25 9:14 ` Richard Biener
2018-07-24 9:57 ` [11/46] Pass back a stmt_vec_info from vect_is_simple_use Richard Sandiford
2018-07-25 9:18 ` Richard Biener
2018-07-24 9:58 ` [12/46] Make vect_finish_stmt_generation return a stmt_vec_info Richard Sandiford
2018-07-25 9:19 ` Richard Biener
2018-07-24 9:58 ` [13/46] Make STMT_VINFO_RELATED_STMT " Richard Sandiford
2018-07-25 9:19 ` Richard Biener
2018-07-24 9:58 ` [14/46] Make STMT_VINFO_VEC_STMT " Richard Sandiford
2018-07-25 9:21 ` Richard Biener
2018-07-25 11:03 ` Richard Sandiford
2018-08-02 0:22 ` H.J. Lu
2018-08-02 9:58 ` Richard Sandiford
2018-07-24 9:59 ` Richard Sandiford [this message]
2018-07-25 9:22 ` [16/46] Make STMT_VINFO_REDUC_DEF " Richard Biener
2018-07-24 9:59 ` [17/46] Make LOOP_VINFO_REDUCTIONS an auto_vec<stmt_vec_info> Richard Sandiford
2018-07-25 9:23 ` Richard Biener
2018-07-24 9:59 ` [15/46] Make SLP_TREE_VEC_STMTS a vec<stmt_vec_info> Richard Sandiford
2018-07-25 9:22 ` Richard Biener
2018-07-24 10:00 ` [18/46] Make SLP_TREE_SCALAR_STMTS " Richard Sandiford
2018-07-25 9:27 ` Richard Biener
2018-07-31 15:03 ` Richard Sandiford
2018-07-24 10:01 ` [20/46] Make *FIRST_ELEMENT and *NEXT_ELEMENT stmt_vec_infos Richard Sandiford
2018-07-25 9:28 ` Richard Biener
2018-07-24 10:01 ` [21/46] Make grouped_stores and reduction_chains use stmt_vec_infos Richard Sandiford
2018-07-25 9:28 ` Richard Biener
2018-07-24 10:01 ` [19/46] Make vect_dr_stmt return a stmt_vec_info Richard Sandiford
2018-07-25 9:28 ` Richard Biener
2018-07-24 10:02 ` [24/46] Make stmt_info_for_cost use " Richard Sandiford
2018-07-25 9:30 ` Richard Biener
2018-07-24 10:02 ` [22/46] Make DR_GROUP_SAME_DR_STMT " Richard Sandiford
2018-07-25 9:29 ` Richard Biener
2018-07-24 10:02 ` [23/46] Make LOOP_VINFO_MAY_MISALIGN_STMTS use stmt_vec_info Richard Sandiford
2018-07-25 9:29 ` Richard Biener
2018-07-24 10:03 ` [26/46] Make more use of dyn_cast in tree-vect* Richard Sandiford
2018-07-25 9:31 ` Richard Biener
2018-07-24 10:03 ` [25/46] Make get_earlier/later_stmt take and return stmt_vec_infos Richard Sandiford
2018-07-25 9:31 ` Richard Biener
2018-07-24 10:03 ` [27/46] Remove duplicated stmt_vec_info lookups Richard Sandiford
2018-07-25 9:32 ` Richard Biener
2018-07-24 10:04 ` [29/46] Use stmt_vec_info instead of gimple stmts internally (part 2) Richard Sandiford
2018-07-25 10:03 ` Richard Biener
2018-07-24 10:04 ` [28/46] Use stmt_vec_info instead of gimple stmts internally (part 1) Richard Sandiford
2018-07-25 9:33 ` Richard Biener
2018-07-24 10:04 ` [30/46] Use stmt_vec_infos rather than gimple stmts for worklists Richard Sandiford
2018-07-25 10:04 ` Richard Biener
2018-07-24 10:05 ` [32/46] Use stmt_vec_info in function interfaces (part 2) Richard Sandiford
2018-07-25 10:06 ` Richard Biener
2018-07-24 10:05 ` [31/46] Use stmt_vec_info in function interfaces (part 1) Richard Sandiford
2018-07-25 10:05 ` Richard Biener
2018-07-24 10:06 ` [34/46] Alter interface to vect_get_vec_def_for_stmt_copy Richard Sandiford
2018-07-25 10:13 ` Richard Biener
2018-07-24 10:06 ` [33/46] Use stmt_vec_infos instead of vec_info/gimple stmt pairs Richard Sandiford
2018-07-25 10:06 ` Richard Biener
2018-07-24 10:06 ` [35/46] Alter interfaces within vect_pattern_recog Richard Sandiford
2018-07-25 10:14 ` Richard Biener
2018-07-24 10:07 ` [36/46] Add a pattern_stmt_p field to stmt_vec_info Richard Sandiford
2018-07-25 10:15 ` Richard Biener
2018-07-25 11:09 ` Richard Sandiford
2018-07-25 11:48 ` Richard Biener
2018-07-26 10:29 ` Richard Sandiford
2018-07-26 11:15 ` Richard Biener
2018-07-24 10:07 ` [37/46] Associate alignment information with stmt_vec_infos Richard Sandiford
2018-07-25 10:18 ` Richard Biener
2018-07-26 10:55 ` Richard Sandiford
2018-07-26 11:13 ` Richard Biener
2018-07-24 10:08 ` [39/46] Replace STMT_VINFO_UNALIGNED_DR with the associated statement Richard Sandiford
2018-07-26 11:08 ` [39/46 v2] Change STMT_VINFO_UNALIGNED_DR to a dr_vec_info Richard Sandiford
2018-07-26 11:13 ` Richard Biener
2018-07-24 10:08 ` [38/46] Pass stmt_vec_infos instead of data_references where relevant Richard Sandiford
2018-07-25 10:21 ` Richard Biener
2018-07-25 11:21 ` Richard Sandiford
2018-07-26 11:05 ` Richard Sandiford
2018-07-26 11:13 ` Richard Biener
2018-07-24 10:09 ` [40/46] Add vec_info::lookup_dr Richard Sandiford
2018-07-26 11:10 ` [40/46 v2] " Richard Sandiford
2018-07-26 11:16 ` Richard Biener
2018-07-24 10:09 ` [42/46] Add vec_info::replace_stmt Richard Sandiford
2018-07-31 12:03 ` Richard Biener
2018-07-24 10:09 ` [41/46] Add vec_info::remove_stmt Richard Sandiford
2018-07-31 12:02 ` Richard Biener
2018-07-24 10:10 ` [43/46] Make free_stmt_vec_info take a stmt_vec_info Richard Sandiford
2018-07-31 12:03 ` Richard Biener
2018-07-24 10:10 ` [45/46] Remove vect_stmt_in_region_p Richard Sandiford
2018-07-31 12:06 ` Richard Biener
2018-07-24 10:10 ` [44/46] Remove global vinfo_for_stmt-related routines Richard Sandiford
2018-07-31 12:05 ` Richard Biener
2018-07-24 10:11 ` [46/46] Turn stmt_vec_info back into a typedef Richard Sandiford
2018-07-31 12:07 ` Richard Biener
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zhyhosxy.fsf@arm.com \
--to=richard.sandiford@arm.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).