User account creation filtered due to spam.

Bug 16538 - Missed jump threading opportunity with struct fields (but RTL thread_jumps does catch it)
Summary: Missed jump threading opportunity with struct fields (but RTL thread_jumps do...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.1.0
Assignee: Not yet assigned to anyone
URL:
Keywords: alias, missed-optimization, TREE
Depends on: 13761
Blocks: 19794
  Show dependency treegraph
 
Reported: 2004-07-14 13:57 UTC by Steven Bosscher
Modified: 2005-06-05 07:43 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2004-10-14 14:19:39


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steven Bosscher 2004-07-14 13:57:01 UTC
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.
Comment 1 Andrew Pinski 2004-07-14 15:28:57 UTC
Confirmed, this is basically PR 13761 really.
Comment 2 Jeffrey A. Law 2005-02-14 20:06:15 UTC
This is not a jump threading issue.  This is an aliasing issue.  If the aliasing
code is fixed, then the new jump thread selection code will handle this correctly.
Comment 3 Jeffrey A. Law 2005-04-23 00:57:59 UTC
This appears to be fixed now (probably the combination of Dan's aliasing
work and the jump threading changes).

Can a bugmaster please close this :-)
Comment 4 Steven Bosscher 2005-04-23 16:47:02 UTC
This was fixed by just Dan's alias patches.