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

--- Comment #18 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-10-26 
19:11:59 UTC ---
I guess you mean LLVM instead of clang, I'm pretty sure the FE doesn't perform
this optimization.

Anyway, given:

#define F(n, exp) \
unsigned long                                   \
f##n (unsigned long a, unsigned long b)         \
{                                               \
  unsigned long sum = 0;                        \
  for (; a < b; a++)                            \
    exp;                                        \
  return sum;                                   \
}

F (1, sum += a)
F (2, sum += 2)
F (3, sum += b)
F (4, sum += a * a)
F (5, sum += a * a * a)
F (6, a * a * a * a * a + 2 * a * a * a + 5 * a)

only the f1/f2/f3 cases make it into chrec_apply (and only f2/f3 are currently
handled there).

Reply via email to