[llvm] [InstCombine] Fold `select Cond, not X, X` into `Cond ^ X` (PR #93591)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 4 06:24:05 PDT 2024


================
@@ -3996,5 +4023,11 @@ Instruction *InstCombinerImpl::visitSelectInst(SelectInst &SI) {
     }
   }
 
+  // select Cond, !X, X -> xor Cond, X
+  // Note: We don't fold select Cond, Y, X -> X (iff X->Y & !X->!Y) here as
+  // it indicates that these two patterns should be canonicalized.
----------------
nikic wrote:

I don't think the comment is helpful with the new implementation, which does not perform implication checks.

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


More information about the llvm-commits mailing list