diff --git a/llvm/lib/VMCore/Constants.cpp b/llvm/lib/VMCore/Constants.cpp index e0daca5a66daa232f3254680fd90a30ed5ee2c28..8b108c23354644dfe8de565a90f5d50148dc6cf6 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); }