PATCH: Early if-converter store if-conversion

Arnold Schwaighofer aschwaighofer at apple.com
Wed May 1 17:41:26 PDT 2013


A non-text attachment was scrubbed...
Name: 0001-TargetInstrInfo-Add-api-to-query-and-change-simple-r.patch
Type: application/octet-stream
Size: 3103 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130501/1d49da36/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Early-if-conversion-Implement-if-conversion-of-store.patch
Type: application/octet-stream
Size: 27054 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130501/1d49da36/attachment-0001.obj>
-------------- next part --------------


Now handles diamonds, multiple stores and mixtures of phis and stores.

When handling multiple stores I ensure correctness by looking at the locations and matching order (this way the effect on memory stays the same even if some may-alias).


On Apr 23, 2013, at 7:08 PM, Jakob Stoklund Olesen <stoklund at 2pi.dk> wrote:

> 
> On Apr 23, 2013, at 1:22 PM, Arnold Schwaighofer <aschwaighofer at apple.com> wrote:
> 
>> This patch performs a similar optimization than my previous attempt did in SimplifyCFG.
>> 
>> This time we convert conditional stores in the early-if converter where we can use trace metrics to gauge the “closeness” of the two stores. If they are likely to be execute close together the cost of the second store should be cheap compared to mispredicting a branch.
>> 
>> This patch needs more tests and probably a target lowering call whether the (sub)target wants to if convert stores. But I wanted to get peoples opinions/input. Also it is not polished yet (so feel free to ignore formatting and similar concerns).
> 
> Hi Arnold,
> 
> This approach makes sense to me since you are basically if-converting memory. Would there be value in handling diamonds as well? I'm thinking both of the case where the two conditional blocks have a store each, and the case where the head block and one conditional block has a store.
> 
> I don't think you should limit this to the case where a block contains only a single store. You could if-convert a mixture of stores and phis at once.
> 
> /jakob



More information about the llvm-commits mailing list