diff --git a/llvm/lib/AsmParser/Lexer.l b/llvm/lib/AsmParser/Lexer.l index 2218aa5164b8..ed1f6bf45705 100644 --- a/llvm/lib/AsmParser/Lexer.l +++ b/llvm/lib/AsmParser/Lexer.l @@ -27,6 +27,7 @@ %{ #include "ParserInternals.h" #include "llvm/Module.h" +#include "llvm/Support/MathExtras.h" #include #include "llvmAsmParser.h" #include @@ -95,17 +96,7 @@ static uint64_t HexIntToVal(const char *Buffer) { // point representation of it. // static double HexToFP(const char *Buffer) { - // Behave nicely in the face of C TBAA rules... see: - // http://www.nullstone.com/htmls/category/aliastyp.htm - union { - uint64_t UI; - double FP; - } UIntToFP; - UIntToFP.UI = HexIntToVal(Buffer); - - assert(sizeof(double) == sizeof(uint64_t) && - "Data sizes incompatible on this target!"); - return UIntToFP.FP; // Cast Hex constant to double + return BitsToDouble(HexIntToVal(Buffer)); // Cast Hex constant to double }