[PATCH] D118066: [SimplifyCFG] Don't speculatively execute preductably-taken block
Evgeniy via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 25 21:47:49 PST 2022
ebrevnov added a comment.
This change implies that speculation is not beneficial regardless whether block is predicted to be taken or untaken. That essentially means that the optimization is not beneficial in most cases of unpredicted (at compile time) branch as well since hardware will actually predict well in most cases. While there is an explicit note that it's hard to do proper cost modeling on IR level there are still some simple cases which are beneficial. So I think we will regress in some cases.
Another thing to consider is (AFAIU) there is a more aggressive version of this optimization on machine level. Thus there could be cases when by not doing the optimization on IR we will still end up with transformation applied on MIR but will miss potential benefit from another IR level optimizations.
To summarize. I think this change may cause improvements and regressions as well. To better asses overall impact we need perf data.
We can start with the motivating example clearly showing benefit of not doing the transform and understand why and how general is the pattern ....
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D118066/new/
https://reviews.llvm.org/D118066
More information about the llvm-commits
mailing list