From: Richard Biener <rguenther@suse.de>
To: "Andre Vieira (lists)" <andre.simoesdiasvieira@arm.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
Richard Sandiford <richard.sandiford@arm.com>,
ebotcazou@gcc.gnu.org
Subject: Re: vect: Make vect_check_gather_scatter reject offsets that aren't multiples of BITS_PER_UNIT [PR107346]
Date: Fri, 28 Oct 2022 13:46:48 +0000 (UTC) [thread overview]
Message-ID: <nycvar.YFH.7.77.849.2210281346390.4294@jbgna.fhfr.qr> (raw)
In-Reply-To: <0f38765b-3ca1-aee5-359e-ae10dd418433@arm.com>
[-- Attachment #1: Type: text/plain, Size: 2306 bytes --]
On Fri, 28 Oct 2022, Andre Vieira (lists) wrote:
>
> On 24/10/2022 14:29, Richard Biener wrote:
> > On Mon, 24 Oct 2022, Andre Vieira (lists) wrote:
> >
> >> Changing if-convert would merely change this testcase but we could still
> >> trigger using a different structure type, changing the size of Int24 to 32
> >> bits rather than 24:
> >> package Loop_Optimization23_Pkg is
> >> type Nibble is mod 2**4;
> >> type Int24 is mod 2**32; -- Changed this from 24->32
> >> type StructA is record
> >> a : Nibble;
> >> b : Int24;
> >> end record;
> >> pragma Pack(StructA);
> >> type StructB is record
> >> a : Nibble;
> >> b : StructA;
> >> end record;
> >> pragma Pack(StructB);
> >> type ArrayOfStructB is array(0..100) of StructB;
> >> procedure Foo (X : in out ArrayOfStructB);
> >> end Loop_Optimization23_Pkg;
> >>
> >> This would yield a DR_REF (dr): (*x_7(D))[_1].b.b where the last 'b' isn't
> >> a
> >> DECL_BIT_FIELD anymore, but the first one still is and still has the
> >> non-multiple of BITS_PER_UNIT offset. Thus passing the
> >> vect_find_stmt_data_reference check and triggering the
> >> vect_check_gather_scatter failure. So unless we go and make sure we always
> >> set
> >> the DECL_BIT_FIELD on all subsequent accesses of a DECL_BIT_FIELD 'struct'
> >> (which is odd enough on its own) then we are better off catching the issue
> >> in
> >> vect_check_gather_scatter ?
> > But it's not only an issue with scatter-gather, other load/store handling
> > assumes it can create a pointer to the start of the access and thus
> > requires BITS_PER_UNIT alignment for each of them. So we need to fail
> > at data-ref analysis somehow.
> >
> > Richard.
>
> Sorry for the delay on this, had some other things come in between. After our
> IRC discussion I believe we agreed that it would be neater to check this in
> vect_check_gather_scatter as I did in the original patch in
> https://gcc.gnu.org/pipermail/gcc-patches/2022-October/604139.html
> The main reasons being that to check earlier we'd need to walk the DR_REF to
> look for any FIELD_DECL that has DECL_BIT_FIELD set and we decided against
> that.
>
> Can you confirm the original patch is OK for trunk?
Yes.
Thanks,
Richard.
> Kind regards,
> Andre
prev parent reply other threads:[~2022-10-28 13:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-21 16:42 Andre Vieira (lists)
2022-10-24 7:17 ` Richard Biener
2022-10-24 8:31 ` Eric Botcazou
2022-10-24 10:31 ` Andre Vieira (lists)
2022-10-24 12:46 ` Richard Biener
2022-10-24 13:24 ` Andre Vieira (lists)
2022-10-24 13:29 ` Richard Biener
2022-10-28 13:43 ` Andre Vieira (lists)
2022-10-28 13:46 ` Richard Biener [this message]
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=nycvar.YFH.7.77.849.2210281346390.4294@jbgna.fhfr.qr \
--to=rguenther@suse.de \
--cc=andre.simoesdiasvieira@arm.com \
--cc=ebotcazou@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=richard.sandiford@arm.com \
/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).