From: Jeff Law <law@redhat.com>
To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com
Subject: Re: [3/6] Add a vec_basic_block structure
Date: Tue, 28 Aug 2018 22:38:00 -0000 [thread overview]
Message-ID: <157952c8-12aa-0888-22ee-eff194b40c59@redhat.com> (raw)
In-Reply-To: <87h8jerb0o.fsf@arm.com>
On 08/28/2018 05:22 AM, Richard Sandiford wrote:
> This patch adds a vec_basic_block that records the scalar phis and
> scalar statements that we need to vectorise. This is a slight
> simplification in its own right, since it avoids unnecesary statement
> lookups and shaves >50 LOC. But the main reason for doing it is
> to allow the rest of the series to treat pattern statements less
> specially.
>
> Putting phis (which are logically parallel) and normal statements
> (which are logically serial) into a single list might seem dangerous,
> but I think in practice it should be fine. Very little vectoriser
> code needs to handle the parallel nature of phis specially, and code
> that does can still do so. Having a single list simplifies code that
> wants to look at every scalar phi or stmt in isolation.
>
> The new test is for cases in which we try to hoist the same expression
> twice, which I broke with an earlier version of the patch.
>
>
> 2018-08-28 Richard Sandiford <richard.sandiford@arm.com>
>
> gcc/
> * tree-vectorizer.h (vec_basic_block): New structure.
> (vec_info::blocks, _stmt_vec_info::block, _stmt_vec_info::prev)
> (_stmt_vec_info::next): New member variables.
> (FOR_EACH_VEC_BB_STMT, FOR_EACH_VEC_BB_STMT_REVERSE): New macros.
> (vec_basic_block::vec_basic_block): New function.
> * tree-vectorizer.c (vec_basic_block::add_to_end): Likewise.
> (vec_basic_block::add_before): Likewise.
> (vec_basic_block::remove): Likewise.
> (vec_info::~vec_info): Free the vec_basic_blocks.
> (vec_info::remove_stmt): Remove the statement from the containing
> vec_basic_block.
> * tree-vect-patterns.c (vect_determine_precisions)
> (vect_pattern_recog): Iterate over vec_basic_blocks.
> * tree-vect-loop.c (vect_determine_vectorization_factor)
> (vect_compute_single_scalar_iteration_cost, vect_update_vf_for_slp)
> (vect_analyze_loop_operations, vect_transform_loop): Likewise.
> (_loop_vec_info::_loop_vec_info): Construct vec_basic_blocks.
> * tree-vect-slp.c (_bb_vec_info::_bb_vec_info): Likewise.
> (vect_detect_hybrid_slp): Iterate over vec_basic_blocks.
> * tree-vect-stmts.c (vect_mark_stmts_to_be_vectorized): Likewise.
> (vect_finish_replace_stmt, vectorizable_condition): Remove the original
> statement from the containing block.
> (hoist_defs_of_uses): Likewise the statement that we're hoisting.
>
> gcc/testsuite/
> * gcc.dg/vect/vect-hoist-1.c: New test.
>
I'm generally not a fan of references to "this" like you do when you add
STMT_INFOs to a VEC_BASIC_BLOCK. I'm going to trust you're not leaving
dangling pointers in the STMT_INFOs and that storing a pointer to the
containing VEC_BASIC_BLOCK within the STMT_INFO is the best way to get
at the data you want.
Firstly standard doubly linked list routines, lots of fairly mechanical
chunks get simplified a bit. Overall it looks quite reasonable.
OK for the trunk.
jeff
next prev parent reply other threads:[~2018-08-28 22:38 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-28 11:19 [0/6] Make vector pattern statements less special Richard Sandiford
2018-08-28 11:20 ` [1/6] Handle gphis in gimple_get_lhs Richard Sandiford
2018-08-28 18:22 ` Jeff Law
2018-08-28 11:21 ` [2/6] Make vec_info::lookup_single_use take a stmt_vec_info Richard Sandiford
2018-08-28 18:25 ` Jeff Law
2018-08-28 11:22 ` [3/6] Add a vec_basic_block structure Richard Sandiford
2018-08-28 22:38 ` Jeff Law [this message]
2018-08-28 11:23 ` [4/6] Make the vectoriser do its own DCE Richard Sandiford
2018-08-28 23:01 ` Jeff Law
2018-08-29 7:16 ` Richard Biener
2018-08-28 11:25 ` [6/6] Link imm uses for pattern stmts Richard Sandiford
2018-08-29 7:43 ` Richard Biener
2018-08-29 9:25 ` Richard Sandiford
2018-08-30 10:24 ` Richard Biener
2018-08-28 11:25 ` [5/6] Insert pattern statements into vec_basic_blocks Richard Sandiford
2018-08-28 23:16 ` Jeff Law
2018-08-29 7:18 ` Richard Biener
2018-08-29 7:55 ` Jakub Jelinek
2018-08-29 8:59 ` Richard Sandiford
2018-08-29 9:10 ` Jakub Jelinek
2018-08-29 9:22 ` Richard Biener
2018-08-29 9:38 ` 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=157952c8-12aa-0888-22ee-eff194b40c59@redhat.com \
--to=law@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=richard.sandiford@arm.com \
/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).