public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "amacleod at redhat dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/106474] DCE depends on how if expressions are nested
Date: Fri, 29 Jul 2022 16:29:54 +0000 [thread overview]
Message-ID: <bug-106474-4-NnHklChPc5@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106474-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106474
--- Comment #2 from Andrew Macleod <amacleod at redhat dot com> ---
(In reply to Richard Biener from comment #1)
> For the failing case we see
>
> <bb 2> :
> if (c_5(D) == s_6(D))
> goto <bb 3>; [INV]
> else
> goto <bb 6>; [INV]
>
> <bb 3> :
> if (c_5(D) != 0)
> goto <bb 6>; [INV]
> else
> goto <bb 4>; [INV]
>
> <bb 4> :
> if (s_6(D) != 0)
> goto <bb 5>; [INV]
> else
> goto <bb 6>; [INV]
>
> and we basically fail to thread 2->3->4->6, eliminating the if (s_6(D) != 0)
> branch when c_5(D) == s_6(D) and c_5(D) == 0.
>
> It looks like relations / equivalences related, but maybe not exactly.
> Andrew?
it is related. Due to the expense, we don't evaluate every equivalence at
every use point. In this case, there was no obvious "trigger" when we see s_6
!= 0 to go query all of the equivalences to see if they have ranges.
However range_from_dom () is now quite efficient and has a "read-only" mode
where it will make a DOM query without filling the cache. I am experimenting
with having the on-entry cache fill also invoke range_from_dom on equivalences
in read-only mode to see if any existing equivalence value can improve the
range.
The initial protoype reduces that test case in EVRP from
<bb 2> :
_1 = ~c_7(D);
_2 = (int) _1;
_3 = ~s_8(D);
_4 = (int) _3;
if (c_7(D) == s_8(D))
goto <bb 3>; [INV]
else
goto <bb 6>; [INV]
<bb 3> :
if (c_7(D) != 0)
goto <bb 6>; [INV]
else
goto <bb 4>; [INV]
<bb 4> :
if (s_8(D) != 0)
goto <bb 5>; [INV]
else
goto <bb 6>; [INV]
<bb 5> :
DCEMarker0_ ();
<bb 6> :
return;
to
<bb 2> :
_1 = ~c_7(D);
_2 = (int) _1;
_3 = ~s_8(D);
_4 = (int) _3;
return;
Let me run some performance numbers and see what the result is to see if there
is any throtteling needed or not.
next prev parent reply other threads:[~2022-07-29 16:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-29 8:24 [Bug c/106474] New: " tmayerl at student dot ethz.ch
2022-07-29 9:51 ` [Bug tree-optimization/106474] " rguenth at gcc dot gnu.org
2022-07-29 16:29 ` amacleod at redhat dot com [this message]
2022-08-02 18:32 ` cvs-commit at gcc dot gnu.org
2022-08-02 20:01 ` amacleod at redhat dot com
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-106474-4-NnHklChPc5@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).