[llvm] [InstCombine] Change (add x, c) to (xor x, c) (PR #75129)

Fujun Han via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 13 22:02:54 PST 2023


Peter9606 wrote:

> @Peter9606 We'd probably approach that as a demanded bits transform (
> 
> https://github.com/llvm/llvm-project/blob/d293a354d076c772ccd2972a71cb4a7d6f9aa410/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp#L492
> 
> ). Convert `X + C` to `X ^ C` if `C` is equal to the top bit of the `DemandedMask`.

Thanks for your detail guidance. @nikic  
PR is updated!

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


More information about the llvm-commits mailing list