This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug optimization/15221] New: a jump threading opportunity blocked by a few intervening instructions


We could turn foo into bar.  That is, if only a few insturctions are blocking
jump threading opportunity, we should put those blocking instructions to both
branches and perform jump threading.

In certain cases, including this one, we have a size win also.

int f0 (void);
int f1 (void);
int g0 (int);
int g1 (int);

int
foo (int a, int c)
{
  int tem;

  if (a)
    tem = f0 ();
  else
    tem = g0 (tem);
  tem += c;
  if (a)
    tem = f0 ();
  else
    tem = g1 (tem);
  tem + 1;
}

int
bar (int a, int c)
{
  int tem;

  if (a)
    {
      tem = f0 ();
      tem += c;
      tem = g0 (tem);
    }
  else
    {
      tem = f1 ();
      tem += c;
      tem = g1 (tem);
    }
  return tem + 1;
}

-- 
           Summary: a jump threading opportunity blocked by a few
                    intervening instructions
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Keywords: pessimizes-code
          Severity: enhancement
          Priority: P2
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kazu at cs dot umass dot edu
                CC: gcc-bugs at gcc dot gnu dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]