From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14589 invoked by alias); 13 Sep 2004 14:12:30 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 14529 invoked from network); 13 Sep 2004 14:12:25 -0000 Received: from unknown (HELO mproxy.gmail.com) (64.233.170.206) by sourceware.org with SMTP; 13 Sep 2004 14:12:25 -0000 Received: by mproxy.gmail.com with SMTP id 78so136307rnk for ; Mon, 13 Sep 2004 07:12:25 -0700 (PDT) Received: by 10.38.78.78 with SMTP id a78mr1345947rnb; Mon, 13 Sep 2004 07:12:25 -0700 (PDT) Received: by 10.38.171.63 with HTTP; Mon, 13 Sep 2004 07:12:25 -0700 (PDT) Message-ID: <84fc9c0004091307124008a1f8@mail.gmail.com> Date: Mon, 13 Sep 2004 14:40:00 -0000 From: Richard Guenther Reply-To: Richard Guenther To: Richard Guenther Subject: Re: Peeling loops at tree level? Cc: gcc@gcc.gnu.org In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: X-SW-Source: 2004-09/txt/msg00765.txt.bz2 On Mon, 13 Sep 2004 16:09:03 +0200 (CEST), Richard Guenther 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 > struct Vector > { > int operator[](int i) const { return val[i]; } > int val[Dim]; > }; > > template > inline int foo(const Vector& x) > { > int res; > for (int i=0; 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) { [...] : 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.