http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55334
--- Comment #15 from Richard Biener <rguenth at gcc dot gnu.org> 2012-12-10
15:33:38 UTC ---
(In reply to comment #4)
> Hmm, this does not help. The problem is indeed that we are not able to figure
> out that the accesses into subarrays of X are mutually independent.
>
> Martin, Michael, I think you are more familiar with MEM_REF, can you take a
> look?
Well, the accesses are lowered to like
(compute_affine_dependence
stmt_a: _21 = MEM[(real(kind=8)[0:D.1986] *)&x + 20247552B][_20];
stmt_b: _23 = MEM[(real(kind=8)[0:D.1983] *)&x][_20];
) -> dependence analysis failed
this lowering of &x.u vs. &x.v (just guessing) does't mix well with
array-based accesses. That is, we cannot translate this kind of accesses
to independently indexed dimensions as dependence analysis likes to have.
Another issue is that the number of iterations is not constant but
190: === get_loop_niters ===Analyzing # of iterations of loop 2
exit condition [2, + , 1](no_overflow) != _2 + -1
bounds on difference of bases: 0 ... 2147483644
result:
# of iterations (unsigned int) _2 + 4294967293, bounded by 2147483644
so we cannot see that in the above case _20 would not run over to the
"other" sub-array of x.
The only way to retain this knowledge is not to lower the high-level form
&x.u and &x.v but to keep it (which in the end won't help because we
cannot reconstruct x.u[_20] or x.v[_20] in any valid way). Or to
retain restrict information - which means _not_ doing IPA-CP.
So, if you can from
(compute_affine_dependence
stmt_a: _21 = MEM[(real(kind=8)[0:D.1986] *)&x + 20247552B][_20];
stmt_b: _23 = MEM[(real(kind=8)[0:D.1983] *)&x][_20];
) -> dependence analysis failed
prove that the base addresses (MEM[(real(kind=8)[0:D.1986] *)&x + 20247552B]
and MEM[(real(kind=8)[0:D.1983] *)&x]) are different objects then
initialize_data_dependence_relation can compute the dependence and all
would be fine. refs_may_alias_p would be the thing to fix to make
them not alias (as you can see the arrays have unknown upper bounds,
so it's not possible to prove they are not the same).