This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: IVopts bug?


2011/11/1 æèæ <duyuehai@gmail.com>:
> Hi all
>
> ÂI found IVopts rewrite a memory access with a weird iv candidate,
> which make it lost its original memory attribute.
> Âa non-local memory access' base pointer was rewrite into a local one,
> and Âit was deleted in pass_cd_dce since
> it was recognized as a local memory access.
>
> here is the case i simplified from a decoder source
>
> foo1(unsigned char* pSrcLeft,
> Â Â unsigned char* pSrcAbove,
> Â Â unsigned char* pSrcAboveLeft,
> Â Â unsigned char* pDst,
> Â Â int dstStep,
> Â Â int leftStep)
> {
> Âsigned int x, y, s;
> Âunsigned char Âp1[5], p2[5], Âp3;
>
> Âp1[0] = *pSrcAboveLeft;
> Âp2[0] = p1[0];
> Âp2[1] = pSrcLeft[0];
> ÂpSrcLeft += leftStep;
> Âp2[2] = pSrcLeft[0];
> ÂpSrcLeft += leftStep;
> Âp2[3] = pSrcLeft[0];
> ÂpSrcLeft += leftStep;
> Âp2[4] = pSrcLeft[0];
>
> Âp1[1] = pSrcAbove[0];
> Âp1[2] = pSrcAbove[1];
> Âp1[3] = pSrcAbove[2];
> Âp1[4] = pSrcAbove[3];
>
> Âp3 = (unsigned char)(((signed int)p1[1] + (signed int)p2[1] +
> (signed int)p1[0]
> Â Â Â Â Â Â Â Â+(signed int)p1[0] + 2 ) >> 2 );
>
> Âfor( y=0; y<4; y++, pDst += dstStep ) {
> Â Âfor( x=y+1; x<4; x++ ) {
> Â Â Â Â Â Â Â Â Â Âs = ( p1[x-y-1] + p1[x-y] + p1[x-y] + p1[x-y+1] + 2 ) >> 2;
> Â Â Â Â Â Â Â Â Â ÂpDst[x] = (unsigned char)s;
> Â Â}
>
> Â ÂpDst[y] = p3; -----------------This memory access
> Â}
> }
>
> before IVopts
>
> ÂD.6508_65 = pDst_88 + y.6_64;
> Â*D.6508_65 = p3_37;
>
> after IVopts
> it was rewrite to
> MEM[symbol: p1, index: ivtmp.161_200, offset: 0B] = p3_37 ,
>
> by
> candidate 15
> Âdepends on 3
> Âvar_before ivtmp.161
> Âvar_after ivtmp.161
> Âincremented before exit test
> Âtype unsigned int
> Âbase (unsigned int) pDst_39(D) - (unsigned int) &p1
> Âstep (unsigned int) (pretmp.28_118 + 1)
>
> so it still is &p1+ pDst - &p1 + step = pDst + step,
> and in pass_cd_dce, is_hidden_global_store () return false for this memory
> since it think this stmt only access local array p1.
>
>
>
> gcc version r180694
>
> Configured with: /home/croseadu/android/_src/src/gcc-src/configure
> --host=i486-linux-gnu --build=i486-linux-gnu
> --target=arm-none-linux-gnueabi
> --prefix=/home/croseadu/android/_src/install/arm-none-linux-gnueabi
> --enable-threads --disable-libmudflap --disable-libssp
> --disable-libstdcxx-pch --with-gnu-as --with-gnu-ld
> --enable-languages=c,c++ --enable-shared --enable-symvers=gnu
> --enable-__cxa_atexit
> --with-specs='%{funwind-tables|fno-unwind-tables|mabi=*|ffreestanding|nostdlib:;:-funwind-tables}'
> --disable-nls --enable-lto
> --with-sysroot=/home/croseadu/android/_src/install/arm-none-linux-gnueabi/arm-none-linux-gnueabi/libc
> --with-build-sysroot=/home/croseadu/android/_src/install/arm-none-linux-gnueabi/arm-none-linux-gnueabi/libc
> --with-gmp=/home/croseadu/android/_src/objs/arm-none-linux-gnueabi/obj/host-libs-/usr
> --with-mpfr=/home/croseadu/android/_src/objs/arm-none-linux-gnueabi/obj/host-libs-/usr
> --with-ppl=/home/croseadu/android/_src/objs/arm-none-linux-gnueabi/obj/host-libs-/usr
> --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic
> -lm' --with-cloog=/home/croseadu/android/_src/objs/arm-none-linux-gnueabi/obj/host-libs-/usr
> --enable-cloog-backend=isl
> --with-mpc=/home/croseadu/android/_src/objs/arm-none-linux-gnueabi/obj/host-libs-/usr
> --enable-poison-system-directories --disable-libquadmath --enable-lto
> --enable-libgomp
> --with-build-time-tools=/home/croseadu/android/_src/install/arm-none-linux-gnueabi/arm-none-linux-gnueabi/bin
> --with-cpu=cortex-a8 --with-float=soft
>
> compile flags:
> -O3 -mfpu=neon -mfloat-abi=softfp -mvectorize-with-neon-double
>
> need file a bug?

Yes, it definitely should not do this kind of stupid (and invalid) thing.

Richard.

>
> Yuehai Du
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]