2011/11/1 杜越海 <duyue...@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 >