Fw: [lno] compute symbolic values for loop counts

Sebastian Pop sebastian.pop@cri.ensmp.fr
Wed May 19 15:13:00 GMT 2004


On Wed, May 19, 2004 at 04:11:11PM +0300, Olga Golovanevsky wrote:
> Hi Sebastian,
> 
> In some cases funciton number_of_iterations_in_loop ()
> returns an interval, such as in the following example:
> 
>         # n_1 = PHI <20(5), 15(1)>;
>         ...
>         # i_3 = PHI <0(6), i_12(9)>;
>       <L7>:
>         a[i_3] = 0;
>         i_12 = i_3 + 1;
>         if (i_12 < n_1) goto <L7>
> 
> 
> The returned tree is:
> 
> <(<unnamed type>)([15, 20] - 1 + 0)> + 1
> 
> We are using this tree in order to generate a temporary
> variable from it, that cannot be done in this case.
> What we are looking for is the value n_1 (or (n_1 - 1) + 1),
> or, in general, the value as it was calculated before
> conversion into interval.
> 
> I expect there are users of this function, who are
> interested in an interval value. Is it a place to generate
> additional api here?
> 
> thanks,
> Olga
> 

The following patch should solve the problem.  Could you try it?

Index: tree-scalar-evolution.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-scalar-evolution.c,v
retrieving revision 1.1.2.47
diff -c -c -3 -p -r1.1.2.47 tree-scalar-evolution.c
*** tree-scalar-evolution.c	13 May 2004 21:14:15 -0000	1.1.2.47
--- tree-scalar-evolution.c	19 May 2004 13:42:58 -0000
*************** number_of_iterations_in_loop (struct loo
*** 2659,2667 ****
        chrec0 = analyze_scalar_evolution (loop, opnd0);
        chrec1 = analyze_scalar_evolution (loop, opnd1);
        
-       chrec0 = instantiate_parameters (loop, chrec0);
-       chrec1 = instantiate_parameters (loop, chrec1);
-       
        if (chrec0 == chrec_top)
  	/* KEEP_IT_SYMBOLIC.  */
  	chrec0 = opnd0;
--- 2659,2664 ----



More information about the Gcc-patches mailing list