public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/51964] Missed tail merging opportunity
Date: Mon, 23 Jan 2012 13:51:00 -0000	[thread overview]
Message-ID: <bug-51964-4-Yijo7aSQbQ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-51964-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51964

--- Comment #1 from vries at gcc dot gnu.org 2012-01-23 13:43:33 UTC ---
I have a still rather vague idea that we might value number the uses rather
than the defs: assign the same number to uses which use a value in the same
way. I don't know how that would work exactly, but the idea is something like
this:
...
syntax:
a -> b      : a is used to copy to b
a -> <b,c,d>: a is used as b to define c and d.

  # .MEMD.1719_7 = PHI <.MEMD.1719_10(5), .MEMD.1719_11(6)>
.MEMD.1719_10(5) -> .MEMD.1719_7
.MEMD.1719_11(6) -> .MEMD.1719_7

  # aD.1712_1 = PHI <aD.1712_4(5), aD.1712_5(6)>
aD.1712_4(5) -> aD.1712_1
aD.1712_5(6) -> aD.1712_1

  # .MEMD.1719_10 = VDEF <.MEMD.1719_6>
  # USE = nonlocal 
  # CLB = nonlocal 
  aD.1712_4 = barD.1703 (7);
bar          -> <call, .MEMD.1719_7, aD.1712_1>
.MEMD.1719_6 -> <vuse, .MEMD.1719_7, aD.1712_1>
7            -> <callarg0, .MEMD.1719_7, aD.1712_1>

  # .MEMD.1719_11 = VDEF <.MEMD.1719_8(D)>
  # USE = nonlocal 
  # CLB = nonlocal 
  aD.1712_5 = barD.1703 (7);
bar             -> <call, .MEMD.1719_7, aD.1712_1>
.MEMD.1719_8(D) -> <vuse, .MEMD.1719_7, aD.1712_1>
7               -> <callarg0, .MEMD.1719_7, aD.1712_1>
...

By comparing the value numbers of the uses of the 2 calls, we can conclude that
the calls use values in the same way, which means we can merge them. And in
order to merge them we need to insert phis to merge the actual values that are
used. In the example above, we would only need a phi for .MEMD.1719_6 and
.MEMD.1719_8(D).

And if we had f.i. 'bar (7)' and 'bar (8)' in the example, this still would
compare equal, and we would have to insert a phi (7,8) and use that as argument
of the tail-merged call to bar.


  reply	other threads:[~2012-01-23 13:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-23 13:45 [Bug tree-optimization/51964] New: " vries at gcc dot gnu.org
2012-01-23 13:51 ` vries at gcc dot gnu.org [this message]
2021-12-28  6:52 ` [Bug tree-optimization/51964] " pinskia at gcc dot gnu.org
2021-12-28  6:56 ` pinskia at gcc dot gnu.org
2021-12-28  6:59 ` pinskia at gcc dot gnu.org
2023-05-06 21:29 ` pinskia at gcc dot gnu.org
2023-05-08  7:41 ` pinskia 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-51964-4-Yijo7aSQbQ@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).