Jump threading causes bad interactions with loops:
int f(int t, int a, int x)
{
  int n, g;
  if (t)
   n = a;
  else
   n = 4;
  for (g=0; g<n; g++)
    x++;
  return x;
}

This should be optimized to:
int f(int t, int a, int x)
{
  int n, g;
  if (t)
   n = a;
  else
   n = 4;
  x+=n;
  return x;
}
But is not because of jump threading getting in the way to dect that the loop
is finite.


-- 
           Summary: Jump threading gets in the way of loops
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org


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

Reply via email to