[llvm] [InstCombine] Fold Xor with or disjoint (PR #105992)

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 27 07:45:53 PDT 2024


XChy wrote:

> > The correct pattern should be (A | B) ^ C --> (A ^ C) ^ B: https://alive2.llvm.org/ce/z/u2vco3
> > The key is to treat or disjoint as xor.
> 
> Is this optimization profitable? We still have the same number of instructions, I think it depends on the target architecture if it has a special handling or if the pipelining prefers XOR.
> 
> this is just a guess.

This fold is profitable if `A ^ C` folds.

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


More information about the llvm-commits mailing list