Fix nasty bug in ::isNeg()
authorChris Lattner <sabre@nondot.org>
Thu, 31 Oct 2002 17:09:06 +0000 (17:09 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 31 Oct 2002 17:09:06 +0000 (17:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4470 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/iOperators.cpp

index 5aa9714eb9355124c31efbba9aed51a2969519a1..5a88986135bd3082389d04dceef10b7e0b6d971d 100644 (file)
@@ -91,7 +91,7 @@ static inline bool isConstantAllOnes(const Value *V) {
 bool BinaryOperator::isNeg(const Value *V) {
   if (const BinaryOperator *Bop = dyn_cast<BinaryOperator>(V))
     return Bop->getOpcode() == Instruction::Sub &&
-      isa<Constant>(Bop->getOperand(0)) && cast<Constant>(V)->isNullValue();
+      Bop->getOperand(0) == Constant::getNullValue(Bop->getType());
   return false;
 }