[llvm] r335652 - [DAGCombiner] use isBitwiseNot to simplify code; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 26 12:46:57 PDT 2018


Author: spatel
Date: Tue Jun 26 12:46:56 2018
New Revision: 335652

URL: http://llvm.org/viewvc/llvm-project?rev=335652&view=rev
Log:
[DAGCombiner] use isBitwiseNot to simplify code; NFC


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

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=335652&r1=335651&r2=335652&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Jun 26 12:46:56 2018
@@ -6932,15 +6932,10 @@ SDValue DAGCombiner::visitSELECT(SDNode
     }
   }
 
-  // select (xor Cond, 1), X, Y -> select Cond, Y, X
   if (VT0 == MVT::i1) {
-    if (N0->getOpcode() == ISD::XOR) {
-      if (auto *C = dyn_cast<ConstantSDNode>(N0->getOperand(1))) {
-        SDValue Cond0 = N0->getOperand(0);
-        if (C->isOne())
-          return DAG.getNode(ISD::SELECT, DL, N1.getValueType(), Cond0, N2, N1);
-      }
-    }
+    // select (not Cond), N1, N2 -> select Cond, N2, N1
+    if (isBitwiseNot(N0))
+      return DAG.getNode(ISD::SELECT, DL, VT, N0->getOperand(0), N2, N1);
   }
 
   // fold selects based on a setcc into other things, such as min/max/abs




More information about the llvm-commits mailing list