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

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 4 06:17:38 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.
----------------
dtcxzyw wrote:

See https://github.com/llvm/llvm-project/pull/90089#discussion_r1588054750.

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


More information about the llvm-commits mailing list