public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenther at suse dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/101925] [10/11/12 Regression] reversed storage order when compiling with -O3 only since r10-4742-g9b75f56d4b7951c6
Date: Mon, 16 Aug 2021 13:16:01 +0000 [thread overview]
Message-ID: <bug-101925-4-W0dQSNHkCV@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-101925-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101925
--- Comment #8 from rguenther at suse dot de <rguenther at suse dot de> ---
On Mon, 16 Aug 2021, ebotcazou at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101925
>
> --- Comment #7 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> > Disabling SRA fixes it also, and I think that SRA drops the rev storage order
> > access attribute. Oddly enough for be_ip6_addr I see the rc.u.addr8[]
> > accesses do _not_ result in reverse_storage_order_for_component_p being true.
> > Why's that so? How should I detect this is subject to re-ordering?
>
> Because semantically this does not change anything, but I agree that the flag
> should be set in this case too for the sake of the optimizer. Please remove
> the test on QImode on line 8844 in c/c-decl.c.
OK, so that fixes it with the vectorizer patch. But then I have no
idea why it breaks in the first place. With -fdbg-cnt=4:4 (the
only "single" vect case that breaks) I see
<bb 2> [local count: 1073741824]:
ip$is_v4_20 = ip.is_v4;
- rc = {};
+ MEM <char[3]> [(struct _be_net_addr *)&rc + 1B] = {};
if (ip$is_v4_20 != 0)
(huh, guess DSE goes bonkers)
- _85 = MEM <unsigned int> [(union *)&ip + 4B];
+ vect_ip6_u_addr8_0_21.88_86 = MEM <const vector(4) char> [(union *)&ip
+ 4B];
...
- MEM <unsigned int> [(union *)&rc + 4B] = _85;
- rc$u$addr_41 ={rev} MEM <int32_t> [(union *)&rc + 4B];
+ _39 = VIEW_CONVERT_EXPR<int>(vect_ip6_u_addr8_0_21.88_86);
looks like bogus FRE here.
So both not really vectorization but followup opt issues.
-fdisable-tree-fre5 makes the testcase work. We're copying
REF_REVERSE_STORAGE_ORDER in copy_reference_ops_from_ref but
vn_reference_eq doesn't compare .reverse, it only has some
early complete out on V_C_E with reverse (aka storage order
barriers - whatever those exactly are). Also vn_reference_lookup_3
uses contains_storage_order_barrier_p in two places but that
again only checks for the V_C_E barrier, not for reverse accesses.
So we're running into
/* 4) Assignment from an SSA name which definition we may be able
to access pieces from or we can combine to a larger entity. */
else if (known_eq (ref->size, maxsize)
&& is_gimple_reg_type (vr->type)
&& !contains_storage_order_barrier_p (vr->operands)
&& gimple_assign_single_p (def_stmt)
&& TREE_CODE (gimple_assign_rhs1 (def_stmt)) == SSA_NAME)
{
...
reverse = reverse_storage_order_for_component_p (lhs);
tree def_rhs = gimple_assign_rhs1 (def_stmt);
if (!reverse
&& !storage_order_barrier_p (lhs)
&& known_size_p (maxsize2)
&& known_eq (maxsize2, size2)
&& adjust_offsets_for_equal_base_address (base, &offset,
base2, &offset2))
{
since LHS is
MEM <vector(4) char> [(union *)&rc + 4B] = vect_ip6_u_addr8_0_21.88_86;
that doesn't trigger anything. But the ref we're looking at (vr) is
from
rc$u$addr_41 ={rev} MEM <int32_t> [(union *)&rc + 4B];
but we don't check that for reverse_storage_order_for_component_p.
We do have check contains_storage_order_barrier_p which easily(?)
could at least look for other .reverse == 1 compontents but
reverse_storage_order_for_component_p is a bit more complicated
due to how it handles array and component refs based on their
aggregate base TYPE_REVERSE_STORAGE_ORDER. I suppose we could
set .reverse for those in copy_reference_ops_from_ref as well.
That fixes it.
next prev parent reply other threads:[~2021-08-16 13:16 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-15 23:43 [Bug c/101925] New: reversed storage order when compiling with -O3 only george.thopas at gmail dot com
2021-08-15 23:50 ` [Bug tree-optimization/101925] " pinskia at gcc dot gnu.org
2021-08-16 8:08 ` [Bug tree-optimization/101925] [10/11/12 Regression] " marxin at gcc dot gnu.org
2021-08-16 8:22 ` [Bug tree-optimization/101925] [10/11/12 Regression] reversed storage order when compiling with -O3 only since r10-4742-g9b75f56d4b7951c6 rguenth at gcc dot gnu.org
2021-08-16 9:27 ` ebotcazou at gcc dot gnu.org
2021-08-16 10:45 ` rguenth at gcc dot gnu.org
2021-08-16 11:20 ` rguenth at gcc dot gnu.org
2021-08-16 12:20 ` ebotcazou at gcc dot gnu.org
2021-08-16 13:16 ` rguenther at suse dot de [this message]
2021-08-16 13:21 ` rguenth at gcc dot gnu.org
2021-08-17 7:25 ` cvs-commit at gcc dot gnu.org
2021-09-06 8:50 ` [Bug tree-optimization/101925] [10/11 " cvs-commit at gcc dot gnu.org
2021-10-13 11:09 ` [Bug tree-optimization/101925] [10 " cvs-commit at gcc dot gnu.org
2021-10-13 11:10 ` rguenth at gcc dot gnu.org
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=bug-101925-4-W0dQSNHkCV@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
/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).