[llvm] [AArch64] Fold CSEL of a CSEL with the same flags (PR #224992)
Henry Jiang via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 24 22:11:09 PDT 2026
mustartt wrote:
> Is there any particular reason we want to do it in ISel as opposed to a fold in InstCombine? Folding select of select with the same (or negated) condition sounds like all targets can benefit.
@SavchenkoValeriy Currently `InstCombine` handles the single use case only. But for our use, we need to support multi use for intermediate ops. It can definitely be implemented in `AggressiveInstCombine` where the IR instruction count is not as strict. A case can be made for implementing it in `InstCombine`, since it is still profitable for downstream optimizations that results in less instructions for both x86 and AArch64.
But if we implement it during ISel, the fold is guaranteed to not increase instruction count or regress performance.
https://github.com/llvm/llvm-project/pull/224992
More information about the llvm-commits
mailing list