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

             Bug #: 50971
           Summary: Only one loop detected when there should be two
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: pins...@gcc.gnu.org


Take:
typedef struct basket
{
    int *a;
    int cost;
    int abs_cost;
} BASKET;
BASKET *perm[50 +300 +1];


int f(int a, int *b, int cut)
{
  do {
  while (perm[a]->abs_cost > cut)
    a++;
  a++;
  } while (b[a]);
  return a;
}
--- CUT ---
Currently cfgloop finds only one loop as both loops start at the same basic
block.

This causes Loop Copy header not do its job and copy the while's loop's header.
 Note the code could be rewritten like to get the same effect:
int f1(int a, int *b, int cut)
{
  do {
  if (perm[a]->abs_cost > cut)
    {
      a++;
      continue;
    }
  a++;
  } while (b[a]);
  return a;
}
--- CUT ---
Note fixing this might help MCF in SPEC 2006.

Reply via email to