[PATCH] D118066: [SimplifyCFG] Don't speculatively execute preductably-taken block
Sotiris Apostolakis via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 29 13:20:04 PST 2022
apostolakis added a comment.
I agree with nikic and ebrevnov in that it is better to avoid converting more selects to branches in SimplifyCFG since they might block other IR-level optimizations.
In general, I think we need to do the inverse. Flatten the CFG more aggressively, allow a simpler control flow that will facilitate IR-level optimizations and then at the end of middle-end make the decision on whether to convert the selects to branches.
I have a RFC on cmov/branch decision-making <https://llvm.discourse.group/t/rfc-cmov-vs-branch-optimization/6040> that proposes extending the logic on CodeGenPrepare or having a pass just before it (essentially at the end of middle-end) .
In the current proposal, I did not change SimplifyCFG but from some preliminary experiments, preventing SimplifyCFG from making such decisions and deferring this for later further improves performance.
Besides, isn't SimplifyCFG supposed to be a canonicalization pass that enables others, rather than an optimization pass.
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