summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorJeff Cohen <jeffc@jolt-lang.org>2005-05-03 03:13:01 +0000
committerJeff Cohen <jeffc@jolt-lang.org>2005-05-03 03:13:01 +0000
commit4e3aedeaa6d4b17f999314e43bd5e91f075d0a4c (patch)
treef63f732135e5189fd0fc6e4b0c051b283e82cd14 /llvm
parent95d8efdfcf4cc8004fd682d846441bba37d44bdf (diff)
downloadbcm5719-llvm-4e3aedeaa6d4b17f999314e43bd5e91f075d0a4c.tar.gz
bcm5719-llvm-4e3aedeaa6d4b17f999314e43bd5e91f075d0a4c.zip
Use ANSI-approved way of getting the value infinity (otherwise VC++ won't compile it)
llvm-svn: 21662
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/VMCore/ConstantFolding.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/VMCore/ConstantFolding.cpp b/llvm/lib/VMCore/ConstantFolding.cpp
index 8cb1c074534..802c9f4011e 100644
--- a/llvm/lib/VMCore/ConstantFolding.cpp
+++ b/llvm/lib/VMCore/ConstantFolding.cpp
@@ -24,6 +24,7 @@
#include "llvm/DerivedTypes.h"
#include "llvm/Function.h"
#include "llvm/Support/GetElementPtrTypeIterator.h"
+#include <limits>
#include <cmath>
using namespace llvm;
@@ -471,9 +472,9 @@ struct DirectFPRules
return ConstantClass::get(*Ty, Result);
}
static Constant *Div(const ConstantClass *V1, const ConstantClass *V2) {
- if (V2->isExactlyValue(0.0)) return ConstantClass::get(*Ty, INFINITY);
- if (V2->isExactlyValue(-0.0)) return ConstantClass::get(*Ty, -INFINITY);
- if (V2->isNullValue()) return 0;
+ BuiltinType inf = std::numeric_limits<BuiltinType>::infinity();
+ if (V2->isExactlyValue(0.0)) return ConstantClass::get(*Ty, inf);
+ if (V2->isExactlyValue(-0.0)) return ConstantClass::get(*Ty, -inf);
BuiltinType R = (BuiltinType)V1->getValue() / (BuiltinType)V2->getValue();
return ConstantClass::get(*Ty, R);
}
OpenPOWER on IntegriCloud