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/52734] [4.7/4.8 Regression] Incorrect optimization of uClibc sbrk()
Date: Tue, 27 Mar 2012 13:08:00 -0000	[thread overview]
Message-ID: <bug-52734-4-pHiBxvRZiD@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-52734-4@http.gcc.gnu.org/bugzilla/>

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

vries at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vries at gcc dot gnu.org

--- Comment #9 from vries at gcc dot gnu.org 2012-03-27 13:05:09 UTC ---
Blocks 3 and 5, with successor 6 are considered equal and merged.
...
  # BLOCK 3 freq:6102
  # PRED: 2 [61.0%]  (true,exec)
  # VUSE <.MEMD.1734_10>
  dddD.1710_3 = bbbD.1703;
  goto <bb 6>;
  # SUCC: 6 [100.0%]  (fallthru,exec)

  # BLOCK 5 freq:2378
  # PRED: 4 [61.0%]  (false,exec)
  # SUCC: 6 [100.0%]  (fallthru,exec)

  # BLOCK 6 freq:10000
  # PRED: 3 [100.0%]  (fallthru,exec) 7 [100.0%]  (fallthru) 5 [100.0%] 
(fallthru,exec)
  # dddD.1710_1 = PHI <dddD.1710_3(3), 0(7), dddD.1710_4(5)>
  # .MEMD.1734_8 = PHI <.MEMD.1734_10(3), .MEMD.1734_11(7), .MEMD.1734_11(5)>
  # VUSE <.MEMD.1734_8>
  return dddD.1710_1;
  # SUCC: EXIT [100.0%] 
...

Tail merge considers 2 blocks equal if the effect at the tail is equal,
meaning:
- the sequence of side effects produced by each block is equal
- the value phis are equal

There are no side effects in block 3 and 5, and the phi alternatives of
dddD.1710_1 for 3 (dddD.1710_3)  and 5 (dddD.1710_4)  are proven equal by gvn.

The problem is that changing the (4->5) edge into a (4->3) edge changes the
value of dddD.1710_3, because block 4 contains a store that affects the load in
block 3.
...
  # BLOCK 4 freq:3898
  # PRED: 2 [39.0%]  (false,exec)
  # VUSE <.MEMD.1734_10>
  dddD.1710_4 = bbbD.1703;
  # .MEMD.1734_11 = VDEF <.MEMD.1734_10>
  # USE = nonlocal null 
  # CLB = nonlocal null 
  D.1724_5 = aaaD.1705 ();
  if (D.1724_5 != 0)
    goto <bb 7>;
  else
    goto <bb 5>;
  # SUCC: 7 [39.0%]  (true,exec) 5 [61.0%]  (false,exec)
...


  parent reply	other threads:[~2012-03-27 13:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-27  5:32 [Bug c/52734] New: " michael at talamasca dot ocis.net
2012-03-27  7:43 ` [Bug c/52734] " rguenth at gcc dot gnu.org
2012-03-27  7:44 ` mikpe at it dot uu.se
2012-03-27  7:54 ` mikpe at it dot uu.se
2012-03-27  7:57 ` mikpe at it dot uu.se
2012-03-27  8:01 ` michael at talamasca dot ocis.net
2012-03-27  8:10 ` michael at talamasca dot ocis.net
2012-03-27  8:38 ` [Bug rtl-optimization/52734] [4.7/4.8 Regression] " rguenth at gcc dot gnu.org
2012-03-27  9:39 ` [Bug tree-optimization/52734] " rguenth at gcc dot gnu.org
2012-03-27 13:08 ` vries at gcc dot gnu.org [this message]
2012-03-27 13:29 ` vries at gcc dot gnu.org
2012-03-27 17:10 ` vries at gcc dot gnu.org
2012-04-10 22:42 ` joerg.jungermann at gmx dot de
2012-04-10 22:58 ` sedat.dilek at gmail dot com
2012-04-11 10:13 ` rguenth at gcc dot gnu.org
2012-04-12 16:26 ` vries at gcc dot gnu.org
2012-04-13 13:19 ` rguenth at gcc dot gnu.org
2012-04-13 19:33 ` vries at gcc dot gnu.org
2012-04-13 19:39 ` sedat.dilek at gmail dot com
2014-02-16 13:16 ` jackie.rosen at hushmail 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-52734-4-pHiBxvRZiD@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).