public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: Robin Dapp <rdapp.gcc@gmail.com>,
	Richard Biener <rguenther@suse.de>,
	gcc-patches@gcc.gnu.org
Cc: "Li, Pan2" <pan2.li@intel.com>
Subject: Re: [PATCH][RFC] middle-end/110237 - wrong MEM_ATTRs for partial loads/stores
Date: Mon, 27 Nov 2023 08:45:39 -0700	[thread overview]
Message-ID: <e203e03d-2967-480b-96ab-40b9020c169a@gmail.com> (raw)
In-Reply-To: <5b04dad7-a241-4ad3-b4a5-b81080b67e90@gmail.com>



On 11/27/23 05:39, Robin Dapp wrote:
>> The easiest way to avoid running into the alias analysis problem is
>> to scrap the MEM_EXPR when we expand the internal functions for
>> partial loads/stores.  That avoids the disambiguation we run into
>> which is realizing that we store to an object of less size as
>> the size of the mode we appear to store.
>>
>> After the patch we see just
>>
>>    [1  S64 A32]
>>
>> so we preserve the alias set, the alignment and the size (the size
>> is redundant if the MEM insn't BLKmode).  That's still not good
>> in case the RTL alias oracle would implement the same
>> disambiguation but it fends off the gimple one.
>>
>> This fixes gcc.dg/torture/pr58955-2.c when built with AVX512
>> and --param=vect-partial-vector-usage=1.
> 
> On riscv we're seeing a similar problem across the testsuite
> and several execution failures as a result.  In the case I
> looked at we move a scalar load upwards over a partial store
> that aliases the load.
> 
> I independently arrived at the spot mentioned in
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110237#c4
> before knowing about the PR.
> 
> I can confirm that your RFC patch fixes at least two of the
> failures,  I haven't checked the others but very likely
> they are similar.
FWIW, it should always be safe to ignore the memory attributes.   So if 
there's a reasonable condition here, then we can use it and just ignore 
the attribute.

Does the attribute on a partial load/store indicate the potential 
load/store size or does it indicate the actual known load/store size. 
If the former, then we probably need to treat it as a may-read/may-write 
kind of reference.

Jeff

  reply	other threads:[~2023-11-27 15:45 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230621075019.7CA813858033@sourceware.org>
2023-11-27 12:39 ` Robin Dapp
2023-11-27 15:45   ` Jeff Law [this message]
2023-11-28  7:50     ` Richard Biener
2023-11-28 10:31       ` Richard Sandiford
2023-11-28 11:21         ` Richard Biener
2023-11-28 11:32           ` Richard Sandiford
2023-11-28 12:17             ` Richard Biener
2023-11-28 15:00       ` Jeff Law
2023-11-29  7:16         ` Richard Biener
     [not found] <20230621074956.1174B3858288@sourceware.org>
2023-06-26  8:29 ` Hongtao Liu
2023-06-26  8:41   ` Richard Biener
     [not found] <20230621074951.F3C3C3858433@sourceware.org>
2023-06-21 15:29 ` Jeff Law
2023-06-22  6:39   ` Richard Biener
2023-06-24 14:32     ` Jeff Law
2023-06-21  7:49 Richard Biener

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=e203e03d-2967-480b-96ab-40b9020c169a@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=pan2.li@intel.com \
    --cc=rdapp.gcc@gmail.com \
    --cc=rguenther@suse.de \
    /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).