Index: docs/LangRef.rst =================================================================== --- docs/LangRef.rst +++ docs/LangRef.rst @@ -4510,8 +4510,8 @@ distance between the two non-equal finite floating-point numbers nearest ``x``. Moreover, ``ulp(NaN)`` is ``NaN``. -The metadata node shall consist of a single positive floating point -number representing the maximum relative error, for example: +The metadata node shall consist of a single positive float type number +representing the maximum relative error, for example: .. code-block:: llvm Index: lib/IR/Verifier.cpp =================================================================== --- lib/IR/Verifier.cpp +++ lib/IR/Verifier.cpp @@ -3668,6 +3668,8 @@ if (ConstantFP *CFP0 = mdconst::dyn_extract_or_null(MD->getOperand(0))) { const APFloat &Accuracy = CFP0->getValueAPF(); + Assert(&Accuracy.getSemantics() == &APFloat::IEEEsingle, + "fpmath accuracy must have float type", &I); Assert(Accuracy.isFiniteNonZero() && !Accuracy.isNegative(), "fpmath accuracy not a positive number!", &I); } else { Index: test/Verifier/fpmath.ll =================================================================== --- test/Verifier/fpmath.ll +++ test/Verifier/fpmath.ll @@ -19,6 +19,8 @@ ; CHECK: fpmath accuracy not a positive number! %z = fadd float %f, %f, !fpmath !6 ; CHECK: fpmath accuracy not a positive number! + %double.fpmath = fadd float %f, %f, !fpmath !7 +; CHECK: fpmath accuracy must have float type ret void } @@ -29,3 +31,4 @@ !4 = !{ float -1.0 } !5 = !{ float 0.0 } !6 = !{ float 0x7FFFFFFF00000000 } +!7 = !{ double 1.0 }