From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] tree-optimization/111125 - avoid BB vectorization in novector loops
Date: Thu, 24 Aug 2023 11:03:06 +0000 (UTC) [thread overview]
Message-ID: <20230824110306.fLW40Ly_Kd2dCrdfA-fKimLa1OM8_NuZiJ4H0oWdHoQ@z> (raw)
When a loop is marked with
#pragma GCC novector
the following makes sure to also skip BB vectorization for contained
blocks. That avoids gcc.dg/vect/bb-slp-29.c failing on aarch64
because of extra BB vectorization therein. I'm not specifically
dealing with sub-loops of novector loops, the desired semantics
isn't documented.
Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.
Richard.
PR tree-optimization/111125
* tree-vect-slp.cc (vect_slp_function): Split at novector
loop entry, do not push blocks in novector loops.
---
gcc/tree-vect-slp.cc | 41 +++++++++++++++++++++++++++++------------
1 file changed, 29 insertions(+), 12 deletions(-)
diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index ace0ff3ef60..0b1c2233017 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -7802,6 +7802,17 @@ vect_slp_function (function *fun)
bbs[0]->loop_father->num, bb->index);
split = true;
}
+ else if (!bbs.is_empty ()
+ && bb->loop_father->header == bb
+ && bb->loop_father->dont_vectorize)
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "splitting region at dont-vectorize loop %d "
+ "entry at bb%d\n",
+ bb->loop_father->num, bb->index);
+ split = true;
+ }
if (split && !bbs.is_empty ())
{
@@ -7809,19 +7820,25 @@ vect_slp_function (function *fun)
bbs.truncate (0);
}
- /* We need to be able to insert at the head of the region which
- we cannot for region starting with a returns-twice call. */
if (bbs.is_empty ())
- if (gcall *first = safe_dyn_cast <gcall *> (first_stmt (bb)))
- if (gimple_call_flags (first) & ECF_RETURNS_TWICE)
- {
- if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "skipping bb%d as start of region as it "
- "starts with returns-twice call\n",
- bb->index);
- continue;
- }
+ {
+ /* We need to be able to insert at the head of the region which
+ we cannot for region starting with a returns-twice call. */
+ if (gcall *first = safe_dyn_cast <gcall *> (first_stmt (bb)))
+ if (gimple_call_flags (first) & ECF_RETURNS_TWICE)
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "skipping bb%d as start of region as it "
+ "starts with returns-twice call\n",
+ bb->index);
+ continue;
+ }
+ /* If the loop this BB belongs to is marked as not to be vectorized
+ honor that also for BB vectorization. */
+ if (bb->loop_father->dont_vectorize)
+ continue;
+ }
bbs.safe_push (bb);
--
2.35.3
reply other threads:[~2023-08-24 11:03 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=20230824110306.fLW40Ly_Kd2dCrdfA-fKimLa1OM8_NuZiJ4H0oWdHoQ@z \
--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).