[llvm] r304775 - [InstSimplify] Remove some redundant code from InstSimplify now that llvm::isKnownNonEqual handles vectors.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 6 00:13:17 PDT 2017


Author: ctopper
Date: Tue Jun  6 02:13:17 2017
New Revision: 304775

URL: http://llvm.org/viewvc/llvm-project?rev=304775&view=rev
Log:
[InstSimplify] Remove some redundant code from InstSimplify now that llvm::isKnownNonEqual handles vectors.

isKnownNonEqual is called a little earlier in this function and can handle the case that we were checking here as well as more complex cases.

Modified:
    llvm/trunk/lib/Analysis/InstructionSimplify.cpp

Modified: llvm/trunk/lib/Analysis/InstructionSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InstructionSimplify.cpp?rev=304775&r1=304774&r2=304775&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/InstructionSimplify.cpp (original)
+++ llvm/trunk/lib/Analysis/InstructionSimplify.cpp Tue Jun  6 02:13:17 2017
@@ -3358,19 +3358,6 @@ static Value *SimplifyICmpInst(unsigned
     }
   }
 
-  // If a bit is known to be zero for A and known to be one for B,
-  // then A and B cannot be equal.
-  if (ICmpInst::isEquality(Pred)) {
-    const APInt *RHSVal;
-    if (match(RHS, m_APInt(RHSVal))) {
-      KnownBits LHSKnown = computeKnownBits(LHS, Q.DL, /*Depth=*/0, Q.AC, Q.CxtI, Q.DT);
-      if (LHSKnown.Zero.intersects(*RHSVal) ||
-          !LHSKnown.One.isSubsetOf(*RHSVal))
-        return Pred == ICmpInst::ICMP_EQ ? ConstantInt::getFalse(ITy)
-                                         : ConstantInt::getTrue(ITy);
-    }
-  }
-
   // If the comparison is with the result of a select instruction, check whether
   // comparing with either branch of the select always yields the same value.
   if (isa<SelectInst>(LHS) || isa<SelectInst>(RHS))




More information about the llvm-commits mailing list