From 241ed4c50097ed7477d9d9794f56a6c657d3ab27 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 23 Jan 2004 00:55:21 +0000 Subject: [PATCH] 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 llvm-svn: 10967 --- llvm/lib/VMCore/Constants.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/llvm/lib/VMCore/Constants.cpp b/llvm/lib/VMCore/Constants.cpp index e0daca5a66da..8b108c233546 100644 --- a/llvm/lib/VMCore/Constants.cpp +++ b/llvm/lib/VMCore/Constants.cpp @@ -701,6 +701,11 @@ ConstantInt *ConstantInt::get(const Type *Ty, unsigned char V) { static ValueMap 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); } -- GitLab