------- Comment #18 from rguenth at gcc dot gnu dot org 2010-07-07 10:30 ------- (In reply to comment #17) > Subject: Re: [4.6 regression] RTL loop > unrolling causes FAIL: gcc.dg/pr39794.c > > > (In reply to comment #15) > > > Subject: Re: [4.6 regression] RTL loop > > > unrolling causes FAIL: gcc.dg/pr39794.c > > > > > > I am not sure what you mean -- I may be misunderstanding how rtl alias > > > analysis > > > works, but as far as I can tell, what unroller does (just preserving the > > > MEM_ATTRs) is conservatively correct (so, potentially it may make us > > > believe > > > that there are dependences that are not really present, but it should not > > > cause > > > a wrong-code bug). > > > > Consider this simplified example: > > > > for (i ...) > > { > > /*A*/ t = a[i]; > > /*B*/ a[i+1] = t; > > } > > MEM_ATTRS would indicate that memory references in A and B do not alias. > > but this is clearly wrong, since B in iteration X aliases with A in iteration > X+1. > So, not a problem in unroller.
It is not wrong. You have the two identical pointers p = &a[i] and q = p + 1. *p and *q do not alias. Never. Now unrolling rewrites p and q but does not adjust MEM_ATTRs. So alias information still claims the same pointer bases are used for every unrolled load/store, which is certainly not true. (In the past we didn't preserve pointer bases at all, which is why we didn't hit this before. Starting with 4.5.0 and export of points-to information we do, so passes need to fix MEM_ATTRs accordingly) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44838