This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/9553] No induction variable elimination
- From: "rakdver at atrey dot karlin dot mff dot cuni dot cz" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Sep 2004 06:36:43 -0000
- Subject: [Bug rtl-optimization/9553] No induction variable elimination
- References: <20030203201601.9553.binsh00@hotmail.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From rakdver at atrey dot karlin dot mff dot cuni dot cz 2004-09-12 06:36 -------
Subject: Re: No induction variable elimination
Hello,
> ------- Additional Comments From pinskia at gcc dot gnu dot org 2004-09-12 01:53 -------
> It is only semi fixed on the mainline:
> ivtmp.7 = &b[0];
>
> <L0>:;
> *(ivtmp.7 - &b[0] + &a[0]) = *ivtmp.7;
> ivtmp.7 = ivtmp.7 + 4B;
> T.22 = &b[0] + 80B;
> if (ivtmp.7 != T.22) goto <L0>; else goto <L2>;
>
> See how we use the same IV over and over and have it offsetof b instead of by 0.
which indeed is optimal code on many architectures; &a[0] - &b[0]
probably cannot be computed in compile time, but even if it has to be
computed in runtime and *(reg + reg) addressing mode needs to be used,
this has the same computation cost and lower register pressure than
creating a second induction variable.
This of course is not necessarily true on architectures with limited
set of addressing modes; if this happens on such architectures, ivopts
cost function needs to be tweaked.
Zdenek
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9553