[llvm] [InstCombine] Remove `sub nuw C_Mask, X` -> `xor X, C_Mask` canoncalization (PR #122607)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 12 08:48:47 PST 2025


goldsteinn wrote:

> TODO List:
> 
>     * [ ]  Address codegen regressions in the backend: https://godbolt.org/z/bbrGjq7ev. We cannot emit single instruction for `sub Mask, X` on Arm-v8 and RISC-V.

This is also true for `X86`. Although this should be easy for the backend to handle as `(sub nuw C_Mask, Y)` is ALWAYS foldable to `(xor Y, C_Mask)` so I would think the backend will basically always be able to undo it.
> 
>     * [ ]  Fix opt regressions. I believe most of them can be addressed with `m_XorLike` matchers.
> 
>     * [ ]  Canonicalize `xor X, C_Mask` into `sub nuw C_Mask, X` if possible. It will expose more CSE opportunities.



https://github.com/llvm/llvm-project/pull/122607


More information about the llvm-commits mailing list