public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix disambiguation against .MASK_STORE
@ 2023-06-12 13:19 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2023-06-12 13:19 UTC (permalink / raw)
  To: gcc-patches

Alias analysis was treating .MASK_STORE as storing a full vector
which means we disambiguate against decls of smaller than vector size.
That's of course wrong and a similar issue was fixed for DSE already.
The following makes sure we set the size of the access to unknown
and only constrain max_size.

This fixes runtime execution FAILs of gfortran.dg/matmul_2.f90,
gfortran.dg/matmul_6.f90 and gfortran.dg/pr91577.f90 when using
AVX512 with full masked loop vectorization on Zen4.

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

	* tree-ssa-alias.cc (call_may_clobber_ref_p_1): For
	.MASK_STORE and friend set the size of the access to
	unknown.
---
 gcc/tree-ssa-alias.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/tree-ssa-alias.cc b/gcc/tree-ssa-alias.cc
index 79ed956e300..b5476e8b41e 100644
--- a/gcc/tree-ssa-alias.cc
+++ b/gcc/tree-ssa-alias.cc
@@ -3072,6 +3072,9 @@ call_may_clobber_ref_p_1 (gcall *call, ao_ref *ref, bool tbaa_p)
 	  ao_ref lhs_ref;
 	  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.  */
+	  lhs_ref.size = -1;
 	  lhs_ref.ref_alias_set = lhs_ref.base_alias_set
 	    = tbaa_p ? get_deref_alias_set
 				   (TREE_TYPE (gimple_call_arg (call, 1))) : 0;
-- 
2.35.3

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-12 13:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-12 13:19 [PATCH] Fix disambiguation against .MASK_STORE Richard Biener

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).