aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-01-23 00:55:21 +0000
committerChris Lattner <sabre@nondot.org>2004-01-23 00:55:21 +0000
commit90fb19ed2c81ed857532c60161108b86d8a1ce94 (patch)
tree60f06ef310e192976439e426d8bb3f27caa732e2
parent6e1f3ec6cd23cbdc2bef9451c25aca041b715119 (diff)
Fix a problem brian ran into with the bytecode reader asserting. It turns
out that the problem was actually the writer writing out a 'null' value because it didn't normalize it. This fixes: test/Regression/Assembler/2004-01-22-FloatNormalization.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10967 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/VMCore/Constants.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp
index e0daca5a66..8b108c2335 100644
--- a/lib/VMCore/Constants.cpp
+++ b/lib/VMCore/Constants.cpp
@@ -701,6 +701,11 @@ ConstantInt *ConstantInt::get(const Type *Ty, unsigned char V) {
static ValueMap<double, Type, ConstantFP> FPConstants;
ConstantFP *ConstantFP::get(const Type *Ty, double V) {
+ if (Ty == Type::FloatTy) {
+ // Force the value through memory to normalize it.
+ volatile float Tmp = V;
+ V = Tmp;
+ }
return FPConstants.getOrCreate(Ty, V);
}