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<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); }