[DAGCombiner] Use APInt::intersects to avoid tmp variable. NFCI.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Mon, 24 Apr 2017 21:43:21 +0000 (21:43 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Mon, 24 Apr 2017 21:43:21 +0000 (21:43 +0000)
llvm-svn: 301258

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

index 9251bf9..aeca3c2 100644 (file)
@@ -4200,12 +4200,13 @@ SDValue DAGCombiner::visitOR(SDNode *N) {
   // reassociate or
   if (SDValue ROR = ReassociateOps(ISD::OR, SDLoc(N), N0, N1))
     return ROR;
+
   // Canonicalize (or (and X, c1), c2) -> (and (or X, c2), c1|c2)
   // iff (c1 & c2) != 0.
   if (N1C && N0.getOpcode() == ISD::AND && N0.getNode()->hasOneUse() &&
              isa<ConstantSDNode>(N0.getOperand(1))) {
     ConstantSDNode *C1 = cast<ConstantSDNode>(N0.getOperand(1));
-    if ((C1->getAPIntValue() & N1C->getAPIntValue()) != 0) {
+    if (C1->getAPIntValue().intersects(N1C->getAPIntValue())) {
       if (SDValue COR = DAG.FoldConstantArithmetic(ISD::OR, SDLoc(N1), VT,
                                                    N1C, C1))
         return DAG.getNode(
@@ -4214,6 +4215,7 @@ SDValue DAGCombiner::visitOR(SDNode *N) {
       return SDValue();
     }
   }
+
   // Simplify: (or (op x...), (op y...))  -> (op (or x, y))
   if (N0.getOpcode() == N1.getOpcode())
     if (SDValue Tmp = SimplifyBinOpWithSameOpcodeHands(N))