Hello,
> >is there the data reference for it in the datarefs array?
> >
> >Zdenek
> >
>
> Using this code after the construction of the data dependance :
>
>
> datarefs = VEC_alloc (data_reference_p, heap, 10);
> dependence_relations = VEC_alloc (ddr_p, heap, 10 * 10);
> compute_data_dependences_for_loop (loop_nest, true, &datarefs,
> &dependence_relations);
>
> static int cnt = 0;
> char s[128];
> sprintf(s,"output%d",cnt++);
> FILE *f = fopen(s,"w");
> dump_data_references(f,datarefs);
> fclose(f);
>
> With this program :
>
> #include <stdio.h>
>
> int fct(int *t);
>
> int main()
> {
> int tab[10];
> int i;
>
> printf("Hello World %d\n",tab[5]);
>
> printf("Sum is : %d\n",fct(tab));
>
> return 0;
> }
>
> int fct(int *t)
> {
> int i=9;
> int res=0;
> int j,a,b;
>
>
> for(i=0;i<10;i++)
> for(j=i+1;j<10;j++)
> {
> a = t[j];
> b = t[i-1];
> res += b - a;
> }
> return res;
> }
>
>
> I got :
>
>
> For the main :
>
> (Data Ref:
> stmt:
> ref:
> base_object:
> )
>
> For fct :
>
> (Data Ref:
> stmt: a_16 = *D.2144_15;
> ref: *D.2144_15;
> base_object:
> Access function 0: {0B, +, 1B}_2
> )
one possibility is that the t[i-1] load got moved out of the loop by
PRE; could you check that the load is still present in the loop?
Zdenek