aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/VMCore/Constants.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp
index 21f19b98b1..e1b0f18dc3 100644
--- a/lib/VMCore/Constants.cpp
+++ b/lib/VMCore/Constants.cpp
@@ -313,7 +313,10 @@ ConstantExpr::ConstantExpr(Constant *C, const std::vector<Constant*> &IdxList,
/// specify the full Instruction::OPCODE identifier.
///
Constant *ConstantExpr::getNeg(Constant *C) {
- return get(Instruction::Sub, getNullValue(C->getType()), C);
+ if (!C->getType()->isFloatingPoint())
+ return get(Instruction::Sub, getNullValue(C->getType()), C);
+ else
+ return get(Instruction::Sub, ConstantFP::get(C->getType(), -0.0), C);
}
Constant *ConstantExpr::getNot(Constant *C) {
assert(isa<ConstantIntegral>(C) && "Cannot NOT a nonintegral type!");