Peeling loops at tree level?
Richard Guenther
richard.guenther@gmail.com
Mon Sep 13 14:40:00 GMT 2004
On Mon, 13 Sep 2004 16:09:03 +0200 (CEST), Richard Guenther
<rguenth@tat.physik.uni-tuebingen.de> wrote:
> Hi!
>
> Do we (I suspect not) peel small loops at tree level yet? This seems
> to inhibit further (tree) optimization of inlined dimension-unaware
> code like:
>
> template <int Dim>
> struct Vector
> {
> int operator[](int i) const { return val[i]; }
> int val[Dim];
> };
>
> template <int Dim>
> inline int foo(const Vector<Dim>& x)
> {
> int res;
> for (int i=0; i<Dim; ++i)
> res += x[i];
> return res;
> }
>
> int bar(const Vector<3>& x)
> {
> return foo(x);
> }
Btw. lno from g++ (GCC) 3.5-tree-ssa-lno 20040630 (merged 20040612)
seems to do the trick:
;; Function int bar(constVector<3>&) (_Z3barRK6VectorILi3EE)
int bar(constVector<3>&) (x)
{
[...]
<bb 0>:
return *&x->val[2] + x->val[1] + x->val[0] + res;
}
So I guess we'll get this feature during further merge of lno?
Thanks,
Richard.
More information about the Gcc
mailing list