http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55334
--- Comment #24 from Martin Jambor <jamborm at gcc dot gnu.org> 2013-02-12 20:10:42 UTC --- Created attachment 29429 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29429 Experimental patch resolving more dependencies This is my (untested, highly experimental) patch to resolve such dependencies. Basically, it 1) treats MEM_REFs as sort-of COMPONENT_REFs on top INDIRECT_REFs and always pushes the offset index to access_fns of a data reference structure, and 2) relaxes the rule that DR_BASE_OBJECTs need to be the same thing for MEM_REFs of DECLs, where we are happy if the DECLs are the same now. It is successful to the extent that vectorization takes place, however the resulting code is even slower. The problem seems to be that IPA-CP does not only inhibit vectorization, it also apparently inhibits moving loop invariant loads out of the loop. E.g. the second load in BB 7 of the clone _22 = MEM[(real(kind=8)[4] *)&x + 58071104B][0]; is moved up to BB 4 in the original function. The vectorizer then also complains about mgrid.f:191: note: Detected interleaving MEM[(real(kind=8)[4] *)&x + 58071104B][0] and MEM[(real(kind=8)[4] *)&x + 58071104B][1] mgrid.f:191: note: Detected interleaving MEM[(real(kind=8)[4] *)&x + 58071104B][0] and MEM[(real(kind=8)[4] *)&x + 58071104B][2] mgrid.f:191: note: Detected interleaving MEM[(real(kind=8)[4] *)&x + 58071104B][0] and MEM[(real(kind=8)[4] *)&x + 58071104B][3] mgrid.f:191: note: Detected interleaving MEM[(real(kind=8)[4] *)&x + 58071104B][1] and MEM[(real(kind=8)[4] *)&x + 58071104B][2] mgrid.f:191: note: Detected interleaving MEM[(real(kind=8)[4] *)&x + 58071104B][1] and MEM[(real(kind=8)[4] *)&x + 58071104B][3] mgrid.f:191: note: Detected interleaving MEM[(real(kind=8)[4] *)&x + 58071104B][2] and MEM[(real(kind=8)[4] *)&x + 58071104B][3] I am convinced there is no reasonably easy fix for this to juggle with in stage 4 and so I am going to submit a patch disabling propagation to and through restrict pointers to arrays. However, I would very much prefer to revert it on trunk immediately after 4.8 is branched off (and thus keep this bug opened). As we try to do more and more IPA stuff on Fortran, we will be bumping into this more often.