public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/16538] New: Missed jump threading opportunity with struct fields (but RTL thread_jumps does catch it)
@ 2004-07-14 13:57 steven at gcc dot gnu dot org
  2004-07-14 15:28 ` [Bug tree-optimization/16538] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-07-14 13:57 UTC (permalink / raw)
  To: gcc-bugs

We are missing a few jump threading opportunities
of the following form in SPEC and in GCC itself:

------------------------------------------------
struct foo
{
  int field1;
  int field2;
};

struct foo glob;

void
bar (void)
{
  struct foo *g1, *g2;
  g1 = g2 = &glob;
  int i;

  if (!g1->field1)
    g1->field2 = g1->field1;

  if (!g2->field1)
    g2->field2 = g2->field1;
}
------------------------------------------------


The .optimized dump looks like this:

;; Function bar (bar)

bar ()
{
  int i;
  struct foo * g2;
  struct foo * g1;
  int T.1;
  int T.0;

<bb 0>:
  if (glob.field1 == 0) goto <L0>; else goto <L1>;

<L0>:;
  glob.field2 = 0;

<L1>:;
  if (glob.field1 == 0) goto <L2>; else goto <L3>;

<L2>:;
  glob.field2 = 0;

<L3>:;
  return;

}


We eventually end up threading this jump on RTL.

-- 
           Summary: Missed jump threading opportunity with struct fields
                    (but RTL thread_jumps does catch it)
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: steven at gcc dot gnu dot org
                CC: dnovillo at redhat dot com,gcc-bugs at gcc dot gnu dot
                    org


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-07-25 15:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-14 13:57 [Bug tree-optimization/16538] New: Missed jump threading opportunity with struct fields (but RTL thread_jumps does catch it) steven at gcc dot gnu dot org
2004-07-14 15:28 ` [Bug tree-optimization/16538] " pinskia at gcc dot gnu dot org
2005-02-14 23:41 ` law at redhat dot com
2005-04-23  0:58 ` law at redhat dot com
2005-04-23 16:47 ` steven at gcc dot gnu dot org
2005-06-05  7:43 ` pinskia at gcc dot gnu dot org
2005-07-25 15:31 ` steven at gcc dot gnu dot org
2005-07-25 15:34 ` steven at gcc dot gnu dot org

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).