From: Richard Sandiford <richard.sandiford@arm.com>
To: gcc-patches@gcc.gnu.org
Subject: [01/11] Schedule SLP earlier
Date: Mon, 30 Jul 2018 11:37:00 -0000 [thread overview]
Message-ID: <87zhy9dkfd.fsf@arm.com> (raw)
In-Reply-To: <874lghez1a.fsf@arm.com> (Richard Sandiford's message of "Mon, 30 Jul 2018 12:36:01 +0100")
vect_transform_loop used to call vect_schedule_slp lazily when it
came across the first SLP statement, but it seems easier to do it
before the main loop.
2018-07-30 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* tree-vect-loop.c (vect_transform_loop_stmt): Remove slp_scheduled
argument.
(vect_transform_loop): Update calls accordingly. Schedule SLP
instances before the main loop, if any exist.
Index: gcc/tree-vect-loop.c
===================================================================
--- gcc/tree-vect-loop.c 2018-07-30 12:32:15.000000000 +0100
+++ gcc/tree-vect-loop.c 2018-07-30 12:32:16.190624704 +0100
@@ -8199,14 +8199,12 @@ scale_profile_for_vect_loop (struct loop
}
/* Vectorize STMT_INFO if relevant, inserting any new instructions before GSI.
- When vectorizing STMT_INFO as a store, set *SEEN_STORE to its stmt_vec_info.
- *SLP_SCHEDULE is a running record of whether we have called
- vect_schedule_slp. */
+ When vectorizing STMT_INFO as a store, set *SEEN_STORE to its
+ stmt_vec_info. */
static void
vect_transform_loop_stmt (loop_vec_info loop_vinfo, stmt_vec_info stmt_info,
- gimple_stmt_iterator *gsi,
- stmt_vec_info *seen_store, bool *slp_scheduled)
+ gimple_stmt_iterator *gsi, stmt_vec_info *seen_store)
{
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
poly_uint64 vf = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
@@ -8237,24 +8235,10 @@ vect_transform_loop_stmt (loop_vec_info
dump_printf_loc (MSG_NOTE, vect_location, "multiple-types.\n");
}
- /* SLP. Schedule all the SLP instances when the first SLP stmt is
- reached. */
- if (slp_vect_type slptype = STMT_SLP_TYPE (stmt_info))
- {
-
- if (!*slp_scheduled)
- {
- *slp_scheduled = true;
-
- DUMP_VECT_SCOPE ("scheduling SLP instances");
-
- vect_schedule_slp (loop_vinfo);
- }
-
- /* Hybrid SLP stmts must be vectorized in addition to SLP. */
- if (slptype == pure_slp)
- return;
- }
+ /* Pure SLP statements have already been vectorized. We still need
+ to apply loop vectorization to hybrid SLP statements. */
+ if (PURE_SLP_STMT (stmt_info))
+ return;
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location, "transform statement.\n");
@@ -8284,7 +8268,6 @@ vect_transform_loop (loop_vec_info loop_
tree niters_vector_mult_vf = NULL_TREE;
poly_uint64 vf = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
unsigned int lowest_vf = constant_lower_bound (vf);
- bool slp_scheduled = false;
gimple *stmt;
bool check_profitability = false;
unsigned int th;
@@ -8390,6 +8373,14 @@ vect_transform_loop (loop_vec_info loop_
/* This will deal with any possible peeling. */
vect_prepare_for_masked_peels (loop_vinfo);
+ /* Schedule the SLP instances first, then handle loop vectorization
+ below. */
+ if (!loop_vinfo->slp_instances.is_empty ())
+ {
+ DUMP_VECT_SCOPE ("scheduling SLP instances");
+ vect_schedule_slp (loop_vinfo);
+ }
+
/* FORNOW: the vectorizer supports only loops which body consist
of one basic block (header + empty latch). When the vectorizer will
support more involved loop forms, the order by which the BBs are
@@ -8468,16 +8459,15 @@ vect_transform_loop (loop_vec_info loop_
stmt_vec_info pat_stmt_info
= loop_vinfo->lookup_stmt (gsi_stmt (subsi));
vect_transform_loop_stmt (loop_vinfo, pat_stmt_info,
- &si, &seen_store,
- &slp_scheduled);
+ &si, &seen_store);
}
stmt_vec_info pat_stmt_info
= STMT_VINFO_RELATED_STMT (stmt_info);
vect_transform_loop_stmt (loop_vinfo, pat_stmt_info, &si,
- &seen_store, &slp_scheduled);
+ &seen_store);
}
vect_transform_loop_stmt (loop_vinfo, stmt_info, &si,
- &seen_store, &slp_scheduled);
+ &seen_store);
}
gsi_next (&si);
if (seen_store)
next prev parent reply other threads:[~2018-07-30 11:37 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-30 11:36 [00/11] Add a vec_basic_block of scalar statements Richard Sandiford
2018-07-30 11:37 ` [02/11] Remove vect_schedule_slp return value Richard Sandiford
2018-08-01 12:49 ` Richard Biener
2018-07-30 11:37 ` Richard Sandiford [this message]
2018-08-01 12:49 ` [01/11] Schedule SLP earlier Richard Biener
2018-07-30 11:38 ` [03/11] Remove vect_transform_stmt grouped_store argument Richard Sandiford
2018-08-01 12:49 ` Richard Biener
2018-07-30 11:38 ` [04/11] Add a vect_orig_stmt helper function Richard Sandiford
2018-08-01 12:50 ` Richard Biener
2018-07-30 11:39 ` [05/11] Add a vect_stmt_to_vectorize " Richard Sandiford
2018-08-01 12:51 ` Richard Biener
2018-07-30 11:41 ` [06/11] Handle VMAT_INVARIANT separately Richard Sandiford
2018-08-01 12:52 ` Richard Biener
2018-07-30 11:42 ` [07/11] Use single basic block array in loop_vec_info Richard Sandiford
2018-08-01 12:58 ` Richard Biener
2018-07-30 11:43 ` [08/11] Make hoist_defs_of_uses use vec_info::lookup_def Richard Sandiford
2018-08-01 13:01 ` Richard Biener
2018-07-30 11:46 ` [10/11] Make the vectoriser do its own DCE Richard Sandiford
2018-07-30 11:46 ` [09/11] Add a vec_basic_block structure Richard Sandiford
2018-07-30 11:47 ` [11/11] Insert pattern statements into vec_basic_blocks Richard Sandiford
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=87zhy9dkfd.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).