Scev analysing number of loop iterations returns (2^32-1) instead of -1
Tobias Grosser
grosser@fim.uni-passau.de
Thu Oct 8 09:54:00 GMT 2009
On Thu, 2009-10-08 at 08:49 +0200, Zdenek Dvorak wrote:
> Hi,
>
> > > Ah, indeed. Sorry for being confused. Is tree-niter-desc->assumptions
> > > or ->may_be_zero non-NULL?
> >
> > Yes both. I attached the gdb content for both.
>
> you need to check may_be_zero, which in your case should contain
> something like N <= 49. If this condition is true, the number of
> iterations of the loop is zero. Please also check the comments
> in tree-flow.h, where the possible outcomes of # of iteration analysis
> are explained.
Yes, I already did this:
(gdb) call debug_generic_expr (ndesc.assumptions)
1
(gdb) call debug_generic_expr (ndesc.may_be_zero)
0
(gdb) call debug_tree (ndesc.assumptions)
<integer_cst 0x29605658 type <boolean_type 0x296145b0 _Bool> constant
1>
(gdb) call debug_tree (ndesc.may_be_zero)
<integer_cst 0x29605620 type <boolean_type 0x296145b0 _Bool> constant
0>
So it seems the "niter" expression should contain the correct solution
for every N. The cases where "niter" is not valid are not fullfilled
following the description in tree-flow.h
Tobias
More information about the Gcc
mailing list