Enhance BinaryOperator::isNot to support vector not.
authorChris Lattner <sabre@nondot.org>
Fri, 15 Jun 2007 06:04:24 +0000 (06:04 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 15 Jun 2007 06:04:24 +0000 (06:04 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37585 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Instructions.cpp

index 92f5486eaacf951391a5cf14fb7dfc37b40bb74d..acb2e35be5eac52a2e77ec03b3498ec5aa6f1f84 100644 (file)
@@ -1404,7 +1404,11 @@ BinaryOperator *BinaryOperator::createNot(Value *Op, const std::string &Name,
 
 // isConstantAllOnes - Helper function for several functions below
 static inline bool isConstantAllOnes(const Value *V) {
-  return isa<ConstantInt>(V) &&cast<ConstantInt>(V)->isAllOnesValue();
+  if (const ConstantInt *CI = dyn_cast<ConstantInt>(V))
+    return CI->isAllOnesValue();
+  if (const ConstantVector *CV = dyn_cast<ConstantVector>(V))
+    return CV->isAllOnesValue();
+  return false;
 }
 
 bool BinaryOperator::isNeg(const Value *V) {