[llvm] [DAG] combineVSelectWithAllOnesOrZeros - fold select Cond, 0, x -> and not(Cond), x (PR #147472)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 8 02:41:18 PDT 2025


================
@@ -9902,11 +9902,14 @@ SDValue DAGCombiner::visitXOR(SDNode *N) {
     if (SDValue Combined = visitADDLike(N))
       return Combined;
 
-  // fold !(x cc y) -> (x !cc y)
+  // fold xor (setcc x y cc) -1 -> setcc x y !cc
+  // Avoid breaking: and (xor (setcc x y cc) -1) z -> andn for vec
----------------
RKSimon wrote:

`and (xor (setcc x y cc) -1) z` -> `and (not(setcc x, y, cc), z)`

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


More information about the llvm-commits mailing list