[llvm] r179957 - SimplifyCFG: If convert single conditional stores

Shuxin Yang shuxin.llvm at gmail.com
Sat Apr 20 17:47:51 PDT 2013


Get an email offline, asking why it is legal.

Sorry for being sloppy, omit one stmt in the example:

    store x = t1 /* omitted in my previous mail*/
    if (....)
        store x = t2
     /* store cannot be sink here due to alias issue*/

    load from x

  =>

     store x = t1
     if(...)
         store x = t2;

      newt = phi(t1, t2)
      replace load with newt





On 4/20/13 5:24 PM, Shuxin Yang wrote:
> I'm not going to discuss how to optimize/hack the famous loops in 
> hmmer, I just focus on
> this transformation.
>
> IMHO, this xform is better motivated by the subsequent loads, which is 
> the case in hmmer.
>
>   ---------------
>   if (cond)
>      store val to x ; // x is just a memory unit, dose not necessary 
> has name.
>
>     ... load from x
>   ---------------
>
> =>
>    if (cond)
>      t = val
>    store x = t
>
>    ... t
>
>   ------------------
>
>   by stripping off the condition of the store stmt, we can git rid of 
> the load expr, which
> seems to be big save regardless the which combination of following 
> conditions take place
>    a)
>       a1 the branch is biased (likely taken)
>       a2) the branch is biased (likely fall-thru)
>       a3) the branch is balanced
>
>    b) the load-store unit of the underlying architecture has 
> load-store forwarding capability.
>
>   if b) dose not hold, it always win as we reduce a expensive load
>   for combination a1 + b, the load request dose not go to cache, 
> however, we still suffer
>    from latency. (FIXME: load-store unit will blindly go through the 
> pipeline).
>   ....
>
>
>
>




More information about the llvm-commits mailing list