[llvm-commits] CVS: llvm/include/llvm/Constants.h
Chris Lattner
lattner at cs.uiuc.edu
Sun Feb 1 16:49:01 PST 2004
Changes in directory llvm/include/llvm:
Constants.h updated: 1.38 -> 1.39
---
Log message:
The first half of a fix for PR218 & test/Regression/Assembler/2004-02-01-NegativeZero.llx
---
Diffs of the changes: (+12 -3)
Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.38 llvm/include/llvm/Constants.h:1.39
--- llvm/include/llvm/Constants.h:1.38 Wed Jan 14 11:06:21 2004
+++ llvm/include/llvm/Constants.h Sun Feb 1 16:48:09 2004
@@ -258,7 +258,8 @@
///
class ConstantFP : public Constant {
double Val;
- friend struct ConstantCreator<ConstantFP, Type, double>;
+ friend struct ConstantCreator<ConstantFP, Type, uint64_t>;
+ friend struct ConstantCreator<ConstantFP, Type, uint32_t>;
ConstantFP(const ConstantFP &); // DO NOT IMPLEMENT
protected:
ConstantFP(const Type *Ty, double V);
@@ -271,8 +272,16 @@
inline double getValue() const { return Val; }
/// isNullValue - Return true if this is the value that would be returned by
- /// getNullValue.
- virtual bool isNullValue() const { return Val == 0; }
+ /// getNullValue. Don't depend on == for doubles to tell us it's zero, it
+ /// considers -0.0 to be null as well as 0.0. :(
+ virtual bool isNullValue() const {
+ union {
+ double V;
+ uint64_t I;
+ } T;
+ T.V = Val;
+ return T.I == 0;
+ }
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ConstantFP *) { return true; }
More information about the llvm-commits
mailing list