------- Additional Comments From rakdver at atrey dot karlin dot mff dot cuni 
dot cz  2005-05-22 21:23 -------
Subject: Re:  missed optimization due with const function and pulling out of 
loops

> > > > Nevertheless, even if we are very strict with the definition, moving
> > > > get_type2 out of the loop is not a good idea, since get_type2 might
> > > > potentially be very expensive (and we have no way how to determine
> > > > that this is not the case), thus we would lose in case get_type2
> > > > should be never executed.
> > > > 
> > > > 
> > > 
> > > Don't we attempt to detect zero trip loops?
> > > (If not, we should :P)
> > 
> > I don't see how this is relevant to the PR.
> > 
> 
> Uh, you claimed we won't move get_type2 out, even if it is const,
> becuase it might not normally execute.
> 
> If we can't prove we don't execute the loop, you should move it out.

I still don't understand what you mean.

> Otherwise, your logic would hold for get_type1 just the same, which we
> *do* move out of the loop.
> 
> IOW, there is no reason to move get_type1 out but not get_type2

The reason is that get_type1 is always executed when the loop is
entered, while get_type2 is not.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21712

Reply via email to