aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/VMCore/Constants.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp
index 080baf8d63..c1324b6b26 100644
--- a/lib/VMCore/Constants.cpp
+++ b/lib/VMCore/Constants.cpp
@@ -482,6 +482,9 @@ bool ConstantFP::isValueValidForType(const Type *Ty, double Val) {
// TODO: Figure out how to test if a double can be cast to a float!
case Type::FloatTyID:
+ float FV = float(Val);
+ double DV = double(FV);
+ return IsNAN(Val) || Val == DV;
case Type::DoubleTyID:
return true; // This is the largest type...
}