public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Yuehai Du <duyuehai@gmail.com>
To: Richard Guenther <richard.guenther@gmail.com>, gcc@gcc.gnu.org
Subject: Re: IVopts bug?
Date: Wed, 02 Nov 2011 05:19:00 -0000	[thread overview]
Message-ID: <CAH3onrVFEc2p_wzUH7Sc8TgePi0O2H1ky_pp8AHS_a927L-q8A@mail.gmail.com> (raw)
In-Reply-To: <CAFiYyc2tqKR2wQmscCt-R2d6acLpepDWf72px1NuC7EvGBbRdg@mail.gmail.com>

2011/11/1 Richard Guenther <richard.guenther@gmail.com>:
> 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
>>
>
file a bug http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50955,  Could
someboy help me to fix this PR? Thank you very much.

Yuehai Du

      reply	other threads:[~2011-11-02  5:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-01  7:42 杜越海
2011-11-01 10:07 ` Richard Guenther
2011-11-02  5:19   ` Yuehai Du [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAH3onrVFEc2p_wzUH7Sc8TgePi0O2H1ky_pp8AHS_a927L-q8A@mail.gmail.com \
    --to=duyuehai@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=richard.guenther@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).