[llvm] [InstCombine] Add combines for `(icmp eq/ne (and X, P2), (and X, -P2))` (PR #94867)

via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 8 13:56:41 PDT 2024


goldsteinn wrote:

> > If P2 is not constant, then we only perform the fold if the and
> > ops are multi-use. This, however, saves an instruction compared to the
> > xor + and variant.
> 
> Unless this also came up in the diffs, please remove it from this PR.
> 
> A possible alternative way to handle the motivating cases would be to allow the fold if X and Y are constants and only one of the ands is one-use. This is better in some ways (handles _any_ constants) and worse in others (does not handle both ands being multi-use).

Drop non-const case.

Did both... (added another commit). If its too much for 1 pr LMK and I'll move to a seperate PR.

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


More information about the llvm-commits mailing list