This is the mail archive of the 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: [patch] conditional store elimination


On 8/28/07, Michael Matz <> wrote:

>this patch fixes PR middle-end/27313 and thereby a performance problem on
>456.hmmer (which now runs in 798 instead of 1080 seconds, i.e. 26%
>improvement).  We talked about how to integrate this better with if
>conversion and make it also do load hoisting, but I fear we won't get to
>that during the time left for stage 2, and meanwhile I'd really like to
>have that improvement in 4.3.
>I tweaked the patch a bit to only do the transformation by default if the
>target has conditional moves.

Sorry, but I didn't find where in the patch you are checking this.
Could you please enlighten?

>  Additionally it now is applied only when
>the store in question is non-trapping because of another shadowing mem
>access, which then also means that the value is in cache already (i.e. I
>don't do it when only TREE_NOTRAP is set).
>For reference again, here is what the transformation does:
>   ... some access to *p ...
>   if (cond)
>     *p = X;
>   cstore = *p;
>   if (cond)
>     cstore = X;
>   *p = cstore;

There is another option, that will prevent the need of speculative load
(and hence all the trapping/non trapping check):
You can transform:

   if (cond)
     *p = X;


      q (points to a dummy stack slot)
      if (cond)
      *q = X;

i.e., choose the address (that you store to) instead of the value.

Few other points...
What do you think about extending this to handle few conditional stores
not only one)?
What is your opinion that also conditional load hoisting will be included

>Later passes then have the possibility to transform the if into a
>conditional store (and transforming the *p read to a copy).
>Bootstrapped and tested (all langs except ada) on x86_64-linux.

FYI, I intend to check it also on SPU. Will keep you posted... :-)


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