public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "steven at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/33828] Issues with code hoisting implementation in gcse.c
Date: Mon, 01 Dec 2008 12:26:00 -0000	[thread overview]
Message-ID: <20081201122459.3558.qmail@sourceware.org> (raw)
In-Reply-To: <bug-33828-280@http.gcc.gnu.org/bugzilla/>



------- Comment #13 from steven at gcc dot gnu dot org  2008-12-01 12:24 -------
After fixing the issue mentioned in comment#2 and comment #8, gcse.c hoisting
hoists things too far up, e.g.:

{ pred ENTRY }
BB1
if (...) goto BB2 else goto BB3
{ succ BB2, BB3 }

{ pred BB1 }
BB2
...
goto BB4
{ succ BB4 }

{ pred BB2 }
BB3
...
goto BB4
{ succ BB4 }

{ pred BB2, BB3 }
BB4
if (...) goto BB5 else goto BB6
{ succ BB5, BB6 }

{ pred BB4 }
BB5
r1 <- exp1
goto BB7
{ succ BB7 }

{ pred BB4 }
BB6
r2 <- exp1
goto BB7
{ succ BB7 }

{ pred BB5, BB6 }
BB7
...
{ succ EXIT }



is transformed to:



{ pred ENTRY }
BB1
r3 <- exp1
if (...) goto BB2 else goto BB3
{ succ BB2, BB3 }

{ pred BB1 }
BB2
...
goto BB4
{ succ BB4 }

{ pred BB2 }
BB3
...
goto BB4
{ succ BB4 }

{ pred BB2, BB3 }
BB4
if (...) goto BB5 else goto BB6
{ succ BB5, BB6 }

{ pred BB4 }
BB5
r1 <- r3
goto BB7
{ succ BB7 }

{ pred BB4 }
BB6
r2 <- r3
goto BB7
{ succ BB7 }

{ pred BB5, BB6 }
BB7
...
{ succ EXIT }



when it would be better to hoist up only to BB4:


{ pred ENTRY }
BB1
if (...) goto BB2 else goto BB3
{ succ BB2, BB3 }

{ pred BB1 }
BB2
...
goto BB4
{ succ BB4 }

{ pred BB2 }
BB3
...
goto BB4
{ succ BB4 }

{ pred BB2, BB3 }
BB4
r3 <- exp1
if (...) goto BB5 else goto BB6
{ succ BB5, BB6 }

{ pred BB4 }
BB5
r1 <- r3
goto BB7
{ succ BB7 }

{ pred BB4 }
BB6
r2 <- r3
goto BB7
{ succ BB7 }

{ pred BB5, BB6 }
BB7
...
{ succ EXIT }


GCC should not hoist up further than up to the first common dominator.


-- 


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


  parent reply	other threads:[~2008-12-01 12:26 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-20 10:18 [Bug rtl-optimization/33828] New: Issues with the implementation of code hoisting " steven at gcc dot gnu dot org
2007-10-20 10:37 ` [Bug rtl-optimization/33828] " steven at gcc dot gnu dot org
2007-10-20 10:48 ` steven at gcc dot gnu dot org
2007-10-20 10:54 ` steven at gcc dot gnu dot org
2007-10-20 11:08 ` steven at gcc dot gnu dot org
2007-10-20 11:10 ` steven at gcc dot gnu dot org
2007-10-20 11:13 ` steven at gcc dot gnu dot org
2007-10-26 23:32 ` steven at gcc dot gnu dot org
2007-10-27 11:34 ` steven at gcc dot gnu dot org
2007-10-28 21:30 ` steven at gcc dot gnu dot org
2007-10-28 21:38 ` steven at gcc dot gnu dot org
2007-10-29 18:59 ` steven at gcc dot gnu dot org
2007-11-01 21:04 ` ebotcazou at gcc dot gnu dot org
2008-09-21 13:14 ` [Bug rtl-optimization/33828] Issues with code hoisting implementation " steven at gcc dot gnu dot org
2008-12-01 12:26 ` steven at gcc dot gnu dot org [this message]
2010-03-25 15:28 ` steven at gcc dot gnu dot org
     [not found] <bug-33828-4@http.gcc.gnu.org/bugzilla/>
2012-03-17  0:06 ` steven 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=20081201122459.3558.qmail@sourceware.org \
    --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).