From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH][2/n] Avoid vectorizing IV update when not necessary
Date: Fri, 02 Jun 2017 10:23:00 -0000 [thread overview]
Message-ID: <alpine.LSU.2.20.1706021222100.5291@zhemvz.fhfr.qr> (raw)
When doing SLP reduction a needlessy marked IV update causes hybrid
SLP and thus pointless unrolling to happen. The following avoids
vectorizing the IV update when not otherwise necessary. Currently
we're creating a dead vector stmt for all inductions that are vectorized.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
Richard.
2017-06-02 Richard Biener <rguenther@suse.de>
* tree-vect-loop.c (vect_analyze_loop_operations): Not relevant
PHIs are ok.
* tree-vect-stmts.c (process_use): Do not mark backedge defs
for inductions as relevant.
Index: gcc/tree-vect-loop.c
===================================================================
--- gcc/tree-vect-loop.c (revision 248788)
+++ gcc/tree-vect-loop.c (working copy)
@@ -1708,8 +1708,7 @@ vect_analyze_loop_operations (loop_vec_i
are not used in the outerloop (unless it is double reduction,
i.e., this phi is vect_reduction_def), cause this case
requires to actually do something here. */
- if ((!STMT_VINFO_RELEVANT_P (stmt_info)
- || STMT_VINFO_LIVE_P (stmt_info))
+ if (STMT_VINFO_LIVE_P (stmt_info)
&& STMT_VINFO_DEF_TYPE (stmt_info)
!= vect_double_reduction_def)
{
Index: gcc/tree-vect-stmts.c
===================================================================
--- gcc/tree-vect-stmts.c (revision 248788)
+++ gcc/tree-vect-stmts.c (working copy)
@@ -579,6 +579,20 @@ process_use (gimple *stmt, tree use, loo
gcc_unreachable ();
}
}
+ /* We are also not interested in uses on loop PHI backedges that are
+ inductions. Otherwise we'll needlessly vectorize the IV increment
+ and cause hybrid SLP for SLP inductions. */
+ else if (gimple_code (stmt) == GIMPLE_PHI
+ && STMT_VINFO_DEF_TYPE (stmt_vinfo) == vect_induction_def
+ && (PHI_ARG_DEF_FROM_EDGE (stmt, loop_latch_edge (bb->loop_father))
+ == use))
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "induction value on backedge.\n");
+ return true;
+ }
+
vect_mark_relevant (worklist, def_stmt, relevant, false);
return true;
reply other threads:[~2017-06-02 10:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=alpine.LSU.2.20.1706021222100.5291@zhemvz.fhfr.qr \
--to=rguenther@suse.de \
--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).