[llvm] [SelectOpt] Support ADD and SUB with zext operands. (PR #115489)
Sotiris Apostolakis via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 20 06:49:30 PST 2024
sapostolakis wrote:
I agree with @fhahn 's point that Add case is no different than the Or case and if there is a regression, the cost modeling would probably need to be adjusted.
So, I am ok with letting this go through, especially given that Florian's testing does not show any regression.
@davemgreen you are right that the predictability of the branch is a missing aspect here that could lead to incorrect cost modeling. The cost model will skip converting to branches if the select is annotated as unpredictable (either with user annotations or populated by other passes; e.g., recently [there was a discussion of feeding back perf data for mispredictions](https://discourse.llvm.org/t/rfc-hwpgo-i-e-adding-new-spgo-feedback-types/80582/5)), but there is no similar heuristic for highly-predictable branches and if I am not mistaken not equivalent annotation (maybe we could add a predictable metadata and populate it based on user hints such as ABSL_PREDICT_TRUE or SPGO mispredict data). The default misprediction rate in the cost model is meant to be conservative and assumes some level of misprediction given that converting to a highly-mispredicting branch is a worse case scenario than a predictable select.
https://github.com/llvm/llvm-project/pull/115489
More information about the llvm-commits
mailing list