public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/110221] With AVX512 fully masking gfortran.dg/pr68146.f ICEs
Date: Fri, 10 Nov 2023 11:34:43 +0000	[thread overview]
Message-ID: <bug-110221-4-DP4eK63NCS@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110221-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110221

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Keywords|                            |ice-on-valid-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2023-11-10
                 CC|                            |rsandifo at gcc dot gnu.org
             Blocks|                            |53947

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
So in this case the stmt requiring the loop mask is only "indirectly" invariant
as the mask itself is inside of the loop but with invariant operands.

What works is avoiding to schedule internal def vectorized stmts outside of the
loop.  That will then leave possible invariant motion to the LIM pass, at
least when no loop masking/len is required.  So I'm testing the following.

diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 3e5814c3a31..80e279d8f50 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -9081,6 +9081,16 @@ vect_schedule_slp_node (vec_info *vinfo,
       /* Emit other stmts after the children vectorized defs which is
         earliest possible.  */
       gimple *last_stmt = NULL;
+      if (auto loop_vinfo = dyn_cast <loop_vec_info> (vinfo))
+       if (LOOP_VINFO_FULLY_MASKED_P (loop_vinfo)
+           || LOOP_VINFO_FULLY_WITH_LENGTH_P (loop_vinfo))
+         {
+           /* But avoid scheduling internal defs outside of the loop when
+              we might have only implicitly tracked loop mask/len defs.  */
+           gimple_stmt_iterator si
+             = gsi_after_labels (LOOP_VINFO_LOOP (loop_vinfo)->header);
+           last_stmt = *si;
+         }
       bool seen_vector_def = false;
       FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
        if (SLP_TREE_DEF_TYPE (child) == vect_internal_def)


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53947
[Bug 53947] [meta-bug] vectorizer missed-optimizations

  parent reply	other threads:[~2023-11-10 11:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-12 12:45 [Bug tree-optimization/110221] New: " rguenth at gcc dot gnu.org
2023-06-12 13:20 ` [Bug tree-optimization/110221] " rguenth at gcc dot gnu.org
2023-11-10 11:34 ` rguenth at gcc dot gnu.org [this message]
2023-11-10 13:17 ` cvs-commit at gcc dot gnu.org
2023-11-10 13:17 ` rguenth at gcc dot gnu.org
2024-01-17 11:46 ` saurabh.jha at arm dot com
2024-02-06 13:20 ` cvs-commit at gcc dot gnu.org
2024-03-01 13:40 ` cvs-commit at gcc dot gnu.org

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=bug-110221-4-DP4eK63NCS@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).