diff options
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 807653b56d..f78a14d427 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -309,10 +309,9 @@ static inline Value *dyn_castNegVal(Value *V) { if (BinaryOperator::isNeg(V)) return BinaryOperator::getNegArgument(cast<BinaryOperator>(V)); - // Constants can be considered to be negated values if they can be folded... - if (Constant *C = dyn_cast<Constant>(V)) - if (!isa<UndefValue>(C)) - return ConstantExpr::getNeg(C); + // Constants can be considered to be negated values if they can be folded. + if (ConstantInt *C = dyn_cast<ConstantInt>(V)) + return ConstantExpr::getNeg(C); return 0; } |