aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/ConstantFold.cpp
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
commita97e8db835cd6655eb537ace67dd46be7e4585b5 (patch)
treebae3b005c02c851ebd8f5eebb28660cd8bd29618 /lib/VMCore/ConstantFold.cpp
parent9974ddab2bac51952f4f6682a37810105dc8292d (diff)
Use ANSI-approved way of getting the value infinity (otherwise VC++ won't compile it)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21662 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/ConstantFold.cpp')
-rw-r--r--lib/VMCore/ConstantFold.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp
index 8cb1c07453..802c9f4011 100644
--- a/lib/VMCore/ConstantFold.cpp
+++ b/lib/VMCore/ConstantFold.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);
}