PATCH: Early if-converter store if-conversion

Jakob Stoklund Olesen stoklund at 2pi.dk
Tue Apr 23 17:08:28 PDT 2013


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