[PATCH] D21694: Verifier: Reject non-float !fpmath
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 24 11:29:54 PDT 2016
arsenm created this revision.
arsenm added a subscriber: llvm-commits.
Code already assumes this is float. getFPAccuracy() crashes on any other type.
http://reviews.llvm.org/D21694
Files:
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 be float
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
@@ -3670,6 +3670,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 be float", &I);
Assert(Accuracy.isFiniteNonZero() && !Accuracy.isNegative(),
"fpmath accuracy not a positive number!", &I);
} else {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21694.61815.patch
Type: text/x-patch
Size: 1117 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160624/426f8183/attachment.bin>
More information about the llvm-commits
mailing list