[llvm] [InstCombine] fold `(a == c && b != c) || (a != c && b == c))` to `(a == c) == (b != c)` (PR #94915)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 21 16:19:47 PDT 2024


================
@@ -3476,7 +3469,7 @@ Instruction *InstCombinerImpl::visitOr(BinaryOperator &I) {
   if (Instruction *X = foldComplexAndOrPatterns(I, Builder))
     return X;
 
-  // (A == c & B != d) | (A != c & B == d)) -> (A == c) | (B == d)
+  // (A == c & B != d) | (A != c & B == d)) -> (A == c) ^ (B == d)
----------------
goldsteinn wrote:

But yeah, to avoid any regressions you could probably just place the function call where the old impl was.

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


More information about the llvm-commits mailing list