[InstCombine] remove checks for IsFreeToInvert()
authorSanjay Patel <spatel@rotateright.com>
Thu, 13 Sep 2018 16:18:12 +0000 (16:18 +0000)
committerSanjay Patel <spatel@rotateright.com>
Thu, 13 Sep 2018 16:18:12 +0000 (16:18 +0000)
I accidentally committed this diff with rL342147 because
I had applied D51964. We probably do need those checks,
but D51964 has tests and more discussion/motivation,
so they should be re-added with that patch.

llvm-svn: 342149

llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp

index aacb38c..a388269 100644 (file)
@@ -1847,9 +1847,7 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
       // MIN(~a, ~b) -> ~MAX(a, b)
       Value *A, *B;
       if (match(LHS, m_Not(m_Value(A))) && match(RHS, m_Not(m_Value(B))) &&
-          !IsFreeToInvert(A, A->hasOneUse()) &&
-          !IsFreeToInvert(B, B->hasOneUse()) &&
-         (!LHS->hasNUsesOrMore(3) || !RHS->hasNUsesOrMore(3))) {
+          (!LHS->hasNUsesOrMore(3) || !RHS->hasNUsesOrMore(3))) {
         CmpInst::Predicate InvertedPred = getInverseMinMaxPred(SPF);
         Value *InvertedCmp = Builder.CreateICmp(InvertedPred, A, B);
         Value *NewSel = Builder.CreateSelect(InvertedCmp, A, B);