[PATCH] D21694: Verifier: Reject non-float !fpmath
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 27 11:47:34 PDT 2016
arsenm updated this revision to Diff 61990.
arsenm marked an inline comment as done.
arsenm added a comment.
Update langref, change error message
http://reviews.llvm.org/D21694
Files:
docs/LangRef.rst
lib/IR/Verifier.cpp
test/Verifier/fpmath.ll
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 }
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<ConstantFP>(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: 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21694.61990.patch
Type: text/x-patch
Size: 1698 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160627/f41c29d1/attachment.bin>
More information about the llvm-commits
mailing list