------- Comment #16 from amonakov at gcc dot gnu dot org 2010-07-07 09:54 ------- (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. Unrolling by 2 produces: for (i ...) { /*A */ t = a[i]; /*B */ a[i+1] = t; /*A'*/ t = a[i+1]; /*B'*/ a[i+2] = t; } Preserving MEM_ATTRS wrongly indicates that memory references in B and A' do not alias, and the scheduler then may happen to lift A' above B. -- amonakov at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |amonakov at gcc dot gnu dot | |org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44838