public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "linkw at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/96376] [11 regression] vect/vect-alias-check.c and vect/vect-live-5.c fail on armeb
Date: Wed, 21 Oct 2020 08:20:58 +0000	[thread overview]
Message-ID: <bug-96376-4-ZnTKxghcgs@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-96376-4@http.gcc.gnu.org/bugzilla/>

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

Kewen Lin <linkw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |linkw at gcc dot gnu.org

--- Comment #5 from Kewen Lin <linkw at gcc dot gnu.org> ---
By checking the case vect-alias-check.c on the sparc machine, although
vectorizer does the versioning for the alignment requirement and is able to set
the misaligned flag off for misaligned DRs, it bypasses the DRs *b_20(D) and
MEM[(int *)b_20(D) + 4B], as they satisfy the condition check
!vect_relevant_for_alignment_p.

   if (aligned_access_p (dr_info)
       || !vect_relevant_for_alignment_p (dr_info))
            continue;

More specific, it's due to these two DR's steps are unchanged in the loop (b[0]
and b[1]).

   /* Scatter-gather and invariant accesses continue to address individual
     scalars, so vector-level alignment is irrelevant.  */
  if (STMT_VINFO_GATHER_SCATTER_P (stmt_info)
      || integer_zerop (DR_STEP (dr_info->dr)))
    return false;

A simple fix seems to be:

  diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index 2b4421b5fb4..d5f52929f89 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -1186,7 +1186,7 @@ vect_update_misalignment_for_peel (dr_vec_info *dr_info,

 /* Return true if alignment is relevant for DR_INFO.  */

-static bool
+bool
 vect_relevant_for_alignment_p (dr_vec_info *dr_info)
 {
   stmt_vec_info stmt_info = dr_info->stmt;
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index cec5c601268..8a04f55fdb1 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -2369,7 +2369,8 @@ get_load_store_type (vec_info  *vinfo, stmt_vec_info
stmt_info,
       return false;
     }

-  if (*alignment_support_scheme == dr_unaligned_unsupported)
+  if (*alignment_support_scheme == dr_unaligned_unsupported
+      && vect_relevant_for_alignment_p (STMT_VINFO_DR_INFO (stmt_info)))
     {
       if (dump_enabled_p ())
        dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index 7c6de8397b3..067222ffe39 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -1935,6 +1935,7 @@ extern tree vect_get_new_ssa_name (tree, enum
vect_var_kind,
 extern tree vect_create_addr_base_for_vector_ref (vec_info *,
                                                  stmt_vec_info, gimple_seq *,
                                                  tree, tree = NULL_TREE);
+bool vect_relevant_for_alignment_p (dr_vec_info *dr_info);

 /* In tree-vect-loop.c.  */
 extern widest_int vect_iv_limit_for_partial_vectors (loop_vec_info
loop_vinfo);

  parent reply	other threads:[~2020-10-21  8:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-29 15:50 [Bug tree-optimization/96376] New: " clyon at gcc dot gnu.org
2020-07-30  6:02 ` [Bug tree-optimization/96376] " rguenth at gcc dot gnu.org
2020-07-30 12:13 ` clyon at gcc dot gnu.org
2020-10-16 11:59 ` rguenth at gcc dot gnu.org
2020-10-16 12:05 ` clyon at gcc dot gnu.org
2020-10-21  7:56 ` linkw at gcc dot gnu.org
2020-10-21  8:20 ` linkw at gcc dot gnu.org [this message]
2021-01-15 14:07 ` cvs-commit at gcc dot gnu.org
2021-01-15 14:08 ` rguenth 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-96376-4-ZnTKxghcgs@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).