diff options
author | dim <dim@FreeBSD.org> | 2012-05-03 16:50:55 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2012-05-03 16:50:55 +0000 |
commit | 2c5e9d71aba3b1a85f07c08d2c09d40b8547264b (patch) | |
tree | 8575c732129e272992ac5d7b4c2519238fff4735 /lib/VMCore/Verifier.cpp | |
parent | 1fc08f5e9ef733ef1ce6f363fecedc2260e78974 (diff) | |
download | FreeBSD-src-2c5e9d71aba3b1a85f07c08d2c09d40b8547264b.zip FreeBSD-src-2c5e9d71aba3b1a85f07c08d2c09d40b8547264b.tar.gz |
Vendor import of llvm release_31 branch r155985:
http://llvm.org/svn/llvm-project/llvm/branches/release_31@155985
Diffstat (limited to 'lib/VMCore/Verifier.cpp')
-rw-r--r-- | lib/VMCore/Verifier.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 96492e4..47baef3 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -1653,16 +1653,18 @@ void Verifier::visitInstruction(Instruction &I) { } } - if (MDNode *MD = I.getMetadata(LLVMContext::MD_fpaccuracy)) { + if (MDNode *MD = I.getMetadata(LLVMContext::MD_fpmath)) { Assert1(I.getType()->isFPOrFPVectorTy(), - "fpaccuracy requires a floating point result!", &I); - Assert1(MD->getNumOperands() == 1, "fpaccuracy takes one operand!", &I); - ConstantFP *Op = dyn_cast_or_null<ConstantFP>(MD->getOperand(0)); - Assert1(Op, "fpaccuracy ULPs not a floating point number!", &I); - APFloat ULPs = Op->getValueAPF(); - Assert1(ULPs.isNormal() || ULPs.isZero(), - "fpaccuracy ULPs not a normal number!", &I); - Assert1(!ULPs.isNegative(), "fpaccuracy ULPs is negative!", &I); + "fpmath requires a floating point result!", &I); + Assert1(MD->getNumOperands() == 1, "fpmath takes one operand!", &I); + Value *Op0 = MD->getOperand(0); + if (ConstantFP *CFP0 = dyn_cast_or_null<ConstantFP>(Op0)) { + APFloat Accuracy = CFP0->getValueAPF(); + Assert1(Accuracy.isNormal() && !Accuracy.isNegative(), + "fpmath accuracy not a positive number!", &I); + } else { + Assert1(false, "invalid fpmath accuracy!", &I); + } } MDNode *MD = I.getMetadata(LLVMContext::MD_range); |