[PING][patch,loopiv] misaligned packed array memory access

Christian BRUEL christian.bruel@st.com
Mon Feb 18 13:46:00 GMT 2008


Zdenek Dvorak wrote:
> Hi,
> 
> 
>>ok, I see now what you meant, just that we also need to pass the 
>>computed offset:
>>
>>    val1 = fold_build2 (MULT_EXPR, type, step, toffset);
> 
> 
> this does not seem to be necessary (step is the step of the
> address of the reference in bytes, no need to multiply it by anything).
> 
> 
>>    val = fold_build2 (PLUS_EXPR, base_type, base, val1);
> 
> 
> I am not sure what you mean by this?  As far as I understand the
> problem, we need to check that
> 
> 1) the address is aligned in the first iteration -- which we do now, and
> 2) the step is a multiple of the alignment
> 
> Zdenek
> 

yes you are right. in fact my original patch was developped against a 
4.2 branch were `may_be_unaligned_p` was called before 'step' was computed.

Well, here is a revisited patch against the mainline using your 
suggestion. I passed the testsuite for sh-superh-elf and bootstraped the 
compiler for i686-pc-linux-gnu.

2008-01-28  Christian Bruel  <christian.bruel@st.com>
             Zdenek Dvorak  <ook@ucw.cz>
	
         * tree-ssa-loop-ivopts.c (may_be_unaligned_p): Check step 
alignment.

2008-01-28  Christian Bruel  <christian.bruel@st.com>

         * gcc.dg/packed-array.c: New testcase.

thanks for your help,

Christian


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: packed_align.trunk.patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080218/c9ac5438/attachment.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: packed-array.c
Type: text/x-c
Size: 487 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080218/c9ac5438/attachment.bin>


More information about the Gcc-patches mailing list