[llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Mar 29 13:52:01 PST 2004


Changes in directory llvm/lib/VMCore:

Constants.cpp updated: 1.83 -> 1.84

---
Log message:

Handle -0.0 correctly


---
Diffs of the changes:  (+4 -1)

Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.83 llvm/lib/VMCore/Constants.cpp:1.84
--- llvm/lib/VMCore/Constants.cpp:1.83	Sun Mar 28 20:37:53 2004
+++ llvm/lib/VMCore/Constants.cpp	Mon Mar 29 13:51:24 2004
@@ -313,7 +313,10 @@
 /// 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!");





More information about the llvm-commits mailing list