InstCombine: Fold away tautological masked compares
[oota-llvm.git] / lib / Transforms / InstCombine / InstCombineAndOrXor.cpp
index 35f0586c914ae3494393958b5fa7159e03f8b78f..55ebcedf9440c40c49fdaa029d91f3c015a27d45 100644 (file)
@@ -776,7 +776,7 @@ static Value *foldLogOpOfMaskedICmps(ICmpInst *LHS, ICmpInst *RHS, bool IsAnd,
     // whole construct
     if (((BCst->getValue() & DCst->getValue()) &
          (CCst->getValue() ^ ECst->getValue())) != 0)
-      return nullptr;
+      return ConstantInt::get(LHS->getType(), !IsAnd);
     Value *newOr1 = Builder->CreateOr(B, D);
     Value *newOr2 = ConstantExpr::getOr(CCst, ECst);
     Value *newAnd = Builder->CreateAnd(A, newOr1);