From: "Andre Vieira (lists)" <andre.simoesdiasvieira@arm.com>
To: Richard Biener <rguenther@suse.de>
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: Mon, 24 Oct 2022 11:31:37 +0100 [thread overview]
Message-ID: <d3a98157-2878-25f4-9cb8-a846b6b55df1@arm.com> (raw)
In-Reply-To: <nycvar.YFH.7.77.849.2210240713450.4294@jbgna.fhfr.qr>
On 24/10/2022 08:17, Richard Biener wrote:
>
> Can you check why vect_find_stmt_data_reference doesn't trip on the
>
> if (TREE_CODE (DR_REF (dr)) == COMPONENT_REF
> && DECL_BIT_FIELD (TREE_OPERAND (DR_REF (dr), 1)))
> {
> free_data_ref (dr);
> return opt_result::failure_at (stmt,
> "not vectorized:"
> " statement is an unsupported"
> " bitfield access %G", stmt);
> }
It used to, which is why this test didn't trigger the error before my
patch, but we lower it to BIT_FIELD_REFs in ifcvt now so it is no longer
a DECL_BIT_FIELD.
But that is a red-herring, if you change the test structure's 'type
Int24 is mod 2**24;' to 'type Int24 is mod 2**32;', thus making the
field we access a normal 32-bit integer, the field no longer is a
DECL_BIT_FIELD and thus my lowering does nothing. However, you will
still get the failure because the field before it is a packed 4-bit
field, making the offset to the field we are accessing less than
BITS_PER_UNIT.
> ? I think we should amend this check and I guess that
> checking multiple_p on DECL_FIELD_BIT_OFFSET should be enough?
That won't work either, unless we do the same walk-through the full
access as we do in get_inner_reference.
Let me elaborate, the 'offending' stmt here is:
_ifc__23 = (*x_7(D))[_1].b.D.3707;
And the struct in question is:
package Loop_Optimization23_Pkg is
type Nibble is mod 2**4;
type Int24 is mod 2**24;
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;
That D.3707 is the 'container'm i.e. the DECL_BIT_FIELD_REPRESENTATIVE
of the original bitfield of type Int24.
So in vect_find_stmt_data_reference , the dr is: (*x_7(D))[_1].b.D.3707 and
TREE_OPERAND (DR_REF (dr), 1): D.3707,
which has DECL_FIELD_BIT_OFFSET: 0
So that check would also pass. However, get_inner_reference, walks the
full access and comes across '.b', the member access for StructA inside
StructB, that has DECL_FIELD_BIT_OFFSET: 4
Which is where we get into trouble. So to catch that here, we would need
to do the same type of walking through all the member accesses, like
get_inner_reference does.
next prev parent reply other threads:[~2022-10-24 10:31 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) [this message]
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
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=d3a98157-2878-25f4-9cb8-a846b6b55df1@arm.com \
--to=andre.simoesdiasvieira@arm.com \
--cc=ebotcazou@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=rguenther@suse.de \
--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).