public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] tree-optimization/113073 - amend PR112736 fix
Date: Tue, 19 Dec 2023 13:30:58 +0100 (CET)	[thread overview]
Message-ID: <20231219123058.CUgvLN9yagTIfeJutfitm-jeOUtFnaA65JmpBOSmJy4@z> (raw)

The PR112736 testcase fails on RISC-V because the aligned exception
uses the wrong check.  The alignment support scheme can be
dr_aligned even when the access isn't aligned to the vector size
but some targets are happy with element alignment.  The following
fixes that.

Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.

	PR tree-optimization/113073
	* tree-vect-stmts.cc (vectorizable_load): Properly ensure
	to exempt only vector-size aligned overreads.
---
 gcc/tree-vect-stmts.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index fc6923cf68a..e9ff728dfd4 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -11476,7 +11476,9 @@ vectorizable_load (vec_info *vinfo,
 				      - (group_size * vf - gap), nunits))
 			  /* DR will be unused.  */
 			  ltype = NULL_TREE;
-			else if (alignment_support_scheme == dr_aligned)
+			else if (known_ge (vect_align,
+					   tree_to_poly_uint64
+					     (TYPE_SIZE_UNIT (vectype))))
 			  /* Aligned access to excess elements is OK if
 			     at least one element is accessed in the
 			     scalar loop.  */
-- 
2.35.3

             reply	other threads:[~2023-12-19 12:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-19 12:30 Richard Biener [this message]
     [not found] <20231219123224.3D481385E459@sourceware.org>
2023-12-20  9:50 ` Thomas Schwinge
2023-12-20 10:21   ` Richard Biener
2023-12-20 13:44     ` Richard Biener
2023-12-20 14:31       ` Thomas Schwinge

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=20231219123058.CUgvLN9yagTIfeJutfitm-jeOUtFnaA65JmpBOSmJy4@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).