DAGCombine should not produce ISD::OR nodes after operation legalization if they...
authorOwen Anderson <resistor@mac.com>
Fri, 31 Jan 2014 00:51:43 +0000 (00:51 +0000)
committerOwen Anderson <resistor@mac.com>
Fri, 31 Jan 2014 00:51:43 +0000 (00:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200503 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/DAGCombiner.cpp

index e96a7aaaf08a42ac7fbff0b17745a9adf621fe52..7dd85a8be745ca798d18f8fdbab1a26aed1b421e 100644 (file)
@@ -1544,8 +1544,10 @@ SDValue DAGCombiner::visitADD(SDNode *N) {
 
       // If all possibly-set bits on the LHS are clear on the RHS, return an OR.
       // If all possibly-set bits on the RHS are clear on the LHS, return an OR.
-      if ((RHSZero & ~LHSZero) == ~LHSZero || (LHSZero & ~RHSZero) == ~RHSZero)
-        return DAG.getNode(ISD::OR, SDLoc(N), VT, N0, N1);
+      if ((RHSZero & ~LHSZero) == ~LHSZero || (LHSZero & ~RHSZero) == ~RHSZero){
+        if (!LegalOperations || TLI.isOperationLegal(ISD::OR, VT))
+          return DAG.getNode(ISD::OR, SDLoc(N), VT, N0, N1);
+      }
     }
   }