[InstCombine] relax use constraint for min/max (~a, ~b) --> ~min/max(a, b)

In the minimal case, this won't remove instructions, but it still improves
uses of existing values.

In the motivating example from PR35834, it does remove instructions, and
sets that case up to be optimized by something like D41603:
https://reviews.llvm.org/D41603

llvm-svn: 321936
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
index b02865c..96b8b4f 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
@@ -1555,8 +1555,8 @@
       // MAX(~a, ~b) -> ~MIN(a, b)
       // MIN(~a, ~b) -> ~MAX(a, b)
       Value *A, *B;
-      if (match(LHS, m_Not(m_Value(A))) && LHS->getNumUses() <= 2 &&
-          match(RHS, m_Not(m_Value(B))) && RHS->getNumUses() <= 2) {
+      if (match(LHS, m_Not(m_Value(A))) && match(RHS, m_Not(m_Value(B))) &&
+          (LHS->getNumUses() <= 2 || RHS->getNumUses() <= 2)) {
         CmpInst::Predicate InvertedPred =
             getCmpPredicateForMinMax(getInverseMinMaxSelectPattern(SPF));
         Value *InvertedCmp = Builder.CreateICmp(InvertedPred, A, B);