This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Disable old loop optimizer
- From: "Giovanni Bajo" <giovannibajo at libero dot it>
- To: "Paul Schlie" <schlie at comcast dot net>
- Cc: <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 14 Apr 2005 01:38:42 +0200
- Subject: Re: [patch] Disable old loop optimizer
- References: <BE82BF6D.9CB9%schlie@comcast.net>
Paul Schlie <schlie@comcast.net> wrote:
>>> 2) loop reversal (i.e. replacing "for (i = 0; i < n; i++) a[i]=i;"
>>> with "for (i = n - 1; i >= 0; i--) a[i]=i;", thus causing us to
>>> compare with zero instead of arbitrary bound, and possibly
>>> shorten the life range of n). Should be trivial within
>>> linear-transform framework, the major problem is to decide when
>>> it is really useful. the major problem is to decide when it is
>>> really useful.
>
> It should be considered to be universally useful: as comparing a value
> against a constant 0 is never more expensive than comparing it
> against an arbitrary constant, [...]
You are totally missing the point: reversing a loop is not the same thing of
reversing just its counter. You should go reading loop-doloop.c.
Giovanni Bajo