PATCH: Early if-converter store if-conversion

Arnold Schwaighofer aschwaighofer at apple.com
Tue Apr 23 13:22:59 PDT 2013


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).

I have (correctness) tested the patch on test-suite+external and "-mllvm -x86-early-ifcvt=true -mllvm -stress-early-ifcvt=true” and observed no correctness regressions.

Performance will have to be analysed (give that the previous patch in simplify cfg did not cause too many regressions I don’t expect many to crop up here - but you never know). Jakob said that there are still some performance regressions with the early-if converter (without my patch). So, I wanted to wait with performance analysis until they are resolved.

I have however confirmed that we still get the 20% in hmmer ;)


Best,
Arnold

Attached are two patches: the first adds an api to targetinstrinfo to query and modify “register to memory stores”. During if-conversion we need to change the value register of such stores and need to compare two stores’ memory locations. The second implements the if-conversion in the early-if conversion pass.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-TargetInstrInfo-Add-api-to-query-and-change-simple-r.patch
Type: application/octet-stream
Size: 4749 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130423/92ba0363/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: 15351 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130423/92ba0363/attachment-0001.obj>
-------------- next part --------------




The thread following my simplify cfg commit http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20130415/172206.html has a discussion why we rather wanted to do this in simplify cfg.


More information about the llvm-commits mailing list