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] Fix disambiguation against .MASK_LOAD
Date: Tue, 13 Jun 2023 08:41:32 +0000 (UTC)	[thread overview]
Message-ID: <20230613084132.R54foC25_0zCHDDTREQUcwWILqxlA0558p_BLVGqIWA@z> (raw)

Alias analysis was treating .MASK_LOAD as storing a full vector
which means we disambiguate against decls of smaller than vector size.
This complements the previous patch handling .MASK_STORE and fixes
runtime execution FAILs of gfortran.dg/matmul_3.f90 and
gfortran.dg/inline_sum_2.f90 when using AVX512 with full masked loop
vectorization on Zen4.

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

	* tree-ssa-alias.cc (ref_maybe_used_by_call_p_1): For
	.MASK_LOAD and friends set the size of the access to unknown.
---
 gcc/tree-ssa-alias.cc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/tree-ssa-alias.cc b/gcc/tree-ssa-alias.cc
index b5476e8b41e..e1bc04b82ba 100644
--- a/gcc/tree-ssa-alias.cc
+++ b/gcc/tree-ssa-alias.cc
@@ -2829,6 +2829,9 @@ ref_maybe_used_by_call_p_1 (gcall *call, ao_ref *ref, bool tbaa_p)
 	      ao_ref_init_from_ptr_and_size (&rhs_ref,
 					     gimple_call_arg (call, 0),
 					     TYPE_SIZE_UNIT (TREE_TYPE (lhs)));
+	      /* We cannot make this a known-size access since otherwise
+		 we disambiguate against refs to decls that are smaller.  */
+	      rhs_ref.size = -1;
 	      rhs_ref.ref_alias_set = rhs_ref.base_alias_set
 		= tbaa_p ? get_deref_alias_set (TREE_TYPE
 					(gimple_call_arg (call, 1))) : 0;
@@ -3073,7 +3076,7 @@ call_may_clobber_ref_p_1 (gcall *call, ao_ref *ref, bool tbaa_p)
 	  ao_ref_init_from_ptr_and_size (&lhs_ref, gimple_call_arg (call, 0),
 					 TYPE_SIZE_UNIT (TREE_TYPE (rhs)));
 	  /* We cannot make this a known-size access since otherwise
-	     we disambiguate against stores to decls that are smaller.  */
+	     we disambiguate against refs to decls that are smaller.  */
 	  lhs_ref.size = -1;
 	  lhs_ref.ref_alias_set = lhs_ref.base_alias_set
 	    = tbaa_p ? get_deref_alias_set
-- 
2.35.3

                 reply	other threads:[~2023-06-13  8:41 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=20230613084132.R54foC25_0zCHDDTREQUcwWILqxlA0558p_BLVGqIWA@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).