diff options
author | Chris Lattner <sabre@nondot.org> | 2004-03-29 19:51:24 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-03-29 19:51:24 +0000 |
commit | d25e3ecb3c3c9e14fef16d77e86039b3504bf960 (patch) | |
tree | 82a3f2df471f08c94d361e642b7161df2bdf8b81 /lib | |
parent | c50bbc9613229ba3e21d64d62827fcc6c5d951cd (diff) |
Handle -0.0 correctly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12530 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/VMCore/Constants.cpp | 5 |
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!"); |