[llvm] 30deb76 - [DAG] visitXOR - add missing comment for or/and constant demorgan fold. NFC.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 15 08:34:15 PDT 2024


Author: Simon Pilgrim
Date: 2024-10-15T16:32:27+01:00
New Revision: 30deb76d46053c243561c6fa072c5a30407241cb

URL: https://github.com/llvm/llvm-project/commit/30deb76d46053c243561c6fa072c5a30407241cb
DIFF: https://github.com/llvm/llvm-project/commit/30deb76d46053c243561c6fa072c5a30407241cb.diff

LOG: [DAG] visitXOR - add missing comment for or/and constant demorgan fold. NFC.

Noticed while triaging #112347 which is using this fold - we described the or->and fold, but not the equivalent and->or which is also handled.

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 924558a298fd85..608ee8558e9928 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -9606,6 +9606,7 @@ SDValue DAGCombiner::visitXOR(SDNode *N) {
     }
   }
   // fold (not (or x, y)) -> (and (not x), (not y)) iff x or y are constants
+  // fold (not (and x, y)) -> (or (not x), (not y)) iff x or y are constants
   if (isAllOnesConstant(N1) && N0.hasOneUse() &&
       (N0Opcode == ISD::OR || N0Opcode == ISD::AND)) {
     SDValue N00 = N0.getOperand(0), N01 = N0.getOperand(1);


        


More information about the llvm-commits mailing list