diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp index 92f5486eaac..acb2e35be5e 100644 --- a/lib/VMCore/Instructions.cpp +++ b/lib/VMCore/Instructions.cpp @@ -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(V) &&cast(V)->isAllOnesValue(); + if (const ConstantInt *CI = dyn_cast(V)) + return CI->isAllOnesValue(); + if (const ConstantVector *CV = dyn_cast(V)) + return CV->isAllOnesValue(); + return false; } bool BinaryOperator::isNeg(const Value *V) {