This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fw: [lno] compute symbolic values for loop counts
- From: Sebastian Pop <sebastian dot pop at cri dot ensmp dot fr>
- To: Olga Golovanevsky <OLGA at il dot ibm dot com>
- Cc: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>, Dorit Naishlos <DORIT at il dot ibm dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 19 May 2004 15:30:29 +0200
- Subject: Re: Fw: [lno] compute symbolic values for loop counts
- References: <OF31FDAE23.7E50BE61-ONC2256E99.00453787-C2256E99.00486FB4@il.ibm.com>
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 ----