[PATCH] D29200: [JumpThread] Enhance finding partial redundant loads by continuing scanning single predecessor

via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 2 08:24:16 PST 2017


Thanks Daniel for the detail.

I believe this is a necessary process to open up more jump threading 
during jump threading tasks even though it could be done in other place. 
This is the initial comment in SimplifyPartiallyRedundantLoad() :
  /// This is an important optimization that encourages jump threading, 
and needs to be run
  /// interlaced with other jump threading tasks.

This patch simply continue scanning to find a loaded value through 
single predecessors, instead of being limited within one single block,  
while respecting the backward scan limit (6 instructions by default).

I observed this patch was applied in spec2000/2006 pretty widely, so I 
will find the case which was not handled before in the whole pipeline.

Thanks,
Jun



On 2017-02-02 10:47, Daniel Berlin via Phabricator wrote:
> dberlin added a comment.
> 
> Also, for the record, all of these testcases are fully redundant loads.
> 
> they are all of the form
> 
>   load
>   if (...)
>   {
>   load
>   }
> 
> This is a full redundancy. The initial load dominates the others, with
> nothing in between, and so they are fully redundant This is also why
> every pass we have that does any load elimination will already
> eliminate them.
> 
> A partially redundant load would be
> 
>   if (a)
>    load a
>   else
>     <nothing>
>   load a
> 
> This load is partially redundant because it unnecessarily happens
> twice when we take the if(a)'s true branch
> 
> PRE will turn it into:
> 
>   if (a)
>    load a
>   else
>    load a
>   result = phi(...)
> 
> As mentioned, GVN already does this transformation, so i'd really like
> to see a testcase where you doing this in jump threading enables an
> optimization we don't get already.
> 
> 
> Repository:
>   rL LLVM
> 
> https://reviews.llvm.org/D29200

-- 
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm 
Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a 
Linux Foundation Collaborative Project.


More information about the llvm-commits mailing list