summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2013-11-13 00:15:44 +0000
committerAaron Ballman <aaron@aaronballman.com>2013-11-13 00:15:44 +0000
commiteb3602472026dc029beb45ccbe09bc84162ba949 (patch)
tree7908547e3b54b45f96a24eddf9f30c7ace487bb0 /include
parent328066513d18acd4e44ad57172c73f1a2a026022 (diff)
downloadllvm-eb3602472026dc029beb45ccbe09bc84162ba949.tar.gz
llvm-eb3602472026dc029beb45ccbe09bc84162ba949.tar.bz2
llvm-eb3602472026dc029beb45ccbe09bc84162ba949.tar.xz
Replacing HUGE_VALF with llvm::huge_valf in order to work around a warning triggered in MSVC 12.
Patch reviewed by Reid Kleckner and Jim Grosbach. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194533 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/CodeGen/LiveInterval.h4
-rw-r--r--include/llvm/Support/MathExtras.h14
2 files changed, 15 insertions, 3 deletions
diff --git a/include/llvm/CodeGen/LiveInterval.h b/include/llvm/CodeGen/LiveInterval.h
index 1b30bf5937..3a9fef6fbd 100644
--- a/include/llvm/CodeGen/LiveInterval.h
+++ b/include/llvm/CodeGen/LiveInterval.h
@@ -541,12 +541,12 @@ namespace llvm {
/// isSpillable - Can this interval be spilled?
bool isSpillable() const {
- return weight != HUGE_VALF;
+ return weight != llvm::huge_valf;
}
/// markNotSpillable - Mark interval as not spillable
void markNotSpillable() {
- weight = HUGE_VALF;
+ weight = llvm::huge_valf;
}
bool operator<(const LiveInterval& other) const {
diff --git a/include/llvm/Support/MathExtras.h b/include/llvm/Support/MathExtras.h
index 00c6ad70d4..17cf4751a0 100644
--- a/include/llvm/Support/MathExtras.h
+++ b/include/llvm/Support/MathExtras.h
@@ -21,7 +21,8 @@
#include <cstring>
#ifdef _MSC_VER
-# include <intrin.h>
+#include <intrin.h>
+#include <limits>
#endif
namespace llvm {
@@ -603,6 +604,17 @@ inline int64_t SignExtend64(uint64_t X, unsigned B) {
return int64_t(X << (64 - B)) >> (64 - B);
}
+#if defined(_MSC_VER)
+ // Visual Studio defines the HUGE_VAL class of macros using purposeful
+ // constant arithmetic overflow, which it then warns on when encountered.
+ const float huge_valf = std::numeric_limits<float>::infinity();
+ const double huge_vald = std::numeric_limits<double>::infinity();
+ const long double huge_vall = std::numeric_limits<long double>::infinity();
+#else
+ const float huge_valf = HUGE_VALF;
+ const double huge_vald = HUGE_VALD;
+ const long double huge_vall = HUGE_VALL;
+#endif
} // End llvm namespace
#endif