aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/InstructionCombining.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/Scalar/InstructionCombining.cpp')
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 8915598da1..9eb30549f4 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -309,7 +309,8 @@ static inline Value *dyn_castNegVal(Value *V) {
// Constants can be considered to be negated values if they can be folded...
if (Constant *C = dyn_cast<Constant>(V))
- return ConstantExpr::getNeg(C);
+ if (!isa<UndefValue>(C))
+ return ConstantExpr::getNeg(C);
return 0;
}