[llvm] [SelectOpt] Support ADD and SUB with zext operands. (PR #115489)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 11 09:56:15 PST 2024
fhahn wrote:
> Do you have performance results for this change? I was trying in the past to try and keep it relatively conservative, as based on the predictability of the branch it can make things better or worse. (We found a case when it was worse recently). We have been looking at some other selects that could benefit from the transform, but I had expected they would only be generally profitable once you considered them part of a larger select group.
>
> My understanding was that the Apple cpus did not use this option either. Do you intend to change that?
I am currently working on enabling it for Apple CPUs and for some motivating cases we need support for `Adds`. The motivating cases are somewhat similar to the ones mentioned in https://github.com/llvm/llvm-project/pull/115745.
Overall enabling it with this change is neutral on SPEC and some other proprietary benchmarks. I agree that there is the risk that if we get it wrong the result can be pretty bad. But I don't think the `Add` case is different to the `Or` case and if anything the cost-model should be responsible for making the decision.
I expect that as we support more cases, we are likely hitting additional cases where the cost-model gets things wrong. What do you think is the best way to make progress here?
https://github.com/llvm/llvm-project/pull/115489
More information about the llvm-commits
mailing list