[Bug tree-optimization/26939] loop number of iterations analysis not working

rakdver at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Feb 18 04:48:00 GMT 2009



------- Comment #22 from rakdver at gcc dot gnu dot org  2009-02-18 04:47 -------
(In reply to comment #21)
> Subject: Re:  loop number of iterations analysis not working
> 
> > If the program terminates before i would wrap, then the number of
> > iterations was not MAXINT.
> > And since it can't wrap, it is not infinite in any case.
> > 
> > I agree you can't prove the number of iterations (since bar could
> > exit), but the requiring the assumption i != MAXINT still seems
> > useless.
> 
> What do you propose that the number of iterations analysis should
> return, then? 

actually, scratch that.  You can redefine the semantics of what number of
iterations analysis returns to make i1 a correct answer, while still keeping it
safe to use for optimizations: "number_of_iterations_exit (EXIT) returns an
expression N such that you don't change the semantics of the program by
replacing the condition for taking EXIT with [0,+,1] == N"
Now I just need to figure out how to make it work this way without completely
rewriting the whole analysis.


-- 


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



More information about the Gcc-bugs mailing list