From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id DACBA3857B98 for ; Tue, 13 Jun 2023 08:41:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DACBA3857B98 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 0E5F92252F for ; Tue, 13 Jun 2023 08:41:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1686645693; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=AD9tFpT4YcZH45ErXetLZW8Ca1lmnyjXEb+lnQNizjg=; b=k97LN547m/z5dgCIbaEc+IeDBPmPf+uAb+BAFdMW9XHqUgoyK5VsLg2D5ZqGjsyYmK6BeC hPt+NFNAhvbRAzI4gG+7hFmlJXW4TNh5nFcwDyc9OXJJ09EdP6RpqD0844A4CeJXYefs2T eQfo6jvK5wyLXAgV5CHCVaO4BHW0+XY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1686645693; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=AD9tFpT4YcZH45ErXetLZW8Ca1lmnyjXEb+lnQNizjg=; b=+6D/df8zHVIZYP7hkMN1T6K/Ein8umZxBrqfHAqfphS3cqf5iwCpSLCub/9I4RCVnlt3ab 60qfzGWItuJJkhAQ== Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 0468C2C141 for ; Tue, 13 Jun 2023 08:41:33 +0000 (UTC) Date: Tue, 13 Jun 2023 08:41:32 +0000 (UTC) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix disambiguation against .MASK_LOAD User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,MISSING_MID,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Message-ID: <20230613084132.R54foC25_0zCHDDTREQUcwWILqxlA0558p_BLVGqIWA@z> 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