Enhance BinaryOperator::isNot to support vector not.
[oota-llvm.git] / 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) {