This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug rtl-optimization/9553] No induction variable elimination


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]