[llvm] [InstCombine] Canonicalize `(sub nuw Mask, X)` -> `(xor Mask, X)` (PR #122542)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 10 21:20:39 PST 2025


goldsteinn wrote:

> > Or just update folds using xor to also accept sub nuw. Let me know which of these sounds most reasonable.
> 
> We can start with adding a matcher for both Xor and `sub nuw MaskC, X`.
> 
Yeah, I guess something like `m_XorLike`.

> > we need some IR flag indicating the equivilence.
> 
> The downside is that we have to fight with more flag preservation bugs :(

Yeah, I don't imagine this is a profitable enough case to make it worth it.

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


More information about the llvm-commits mailing list