aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Constants.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-02-01 22:48:09 +0000
committerChris Lattner <sabre@nondot.org>2004-02-01 22:48:09 +0000
commitcf2c4f8ae52d5f0a01ab40eda6d165f91b8de441 (patch)
tree4c562f92a8a7539849c15911a9aed490cc8ed210 /include/llvm/Constants.h
parent18b34e8b1bac0a1b90c7869bda9d05d457c21417 (diff)
downloadexternal_llvm-cf2c4f8ae52d5f0a01ab40eda6d165f91b8de441.tar.gz
external_llvm-cf2c4f8ae52d5f0a01ab40eda6d165f91b8de441.tar.bz2
external_llvm-cf2c4f8ae52d5f0a01ab40eda6d165f91b8de441.zip
The first half of a fix for PR218 & test/Regression/Assembler/2004-02-01-NegativeZero.llx
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11063 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Constants.h')
-rw-r--r--include/llvm/Constants.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h
index 8d0ec281f8..79b6322dbf 100644
--- a/include/llvm/Constants.h
+++ b/include/llvm/Constants.h
@@ -258,7 +258,8 @@ public:
///
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 @@ public:
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; }