Verify the predicates on icmp/fcmp. Suggested by Jeff Yasskin!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111787 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nick Lewycky 2010-08-22 23:45:14 +00:00
parent 24a1182184
commit 55e97d47c4

View File

@ -1291,6 +1291,10 @@ void Verifier::visitICmpInst(ICmpInst& IC) {
// Check that the operands are the right type
Assert1(Op0Ty->isIntOrIntVectorTy() || Op0Ty->isPointerTy(),
"Invalid operand types for ICmp instruction", &IC);
// Check that the predicate is valid.
Assert1(IC.getPredicate() >= CmpInst::FIRST_ICMP_PREDICATE &&
IC.getPredicate() <= CmpInst::LAST_ICMP_PREDICATE,
"Invalid predicate in ICmp instruction!", &IC);
visitInstruction(IC);
}
@ -1304,6 +1308,11 @@ void Verifier::visitFCmpInst(FCmpInst& FC) {
// Check that the operands are the right type
Assert1(Op0Ty->isFPOrFPVectorTy(),
"Invalid operand types for FCmp instruction", &FC);
// Check that the predicate is valid.
Assert1(FC.getPredicate() >= CmpInst::FIRST_FCMP_PREDICATE &&
FC.getPredicate() <= CmpInst::LAST_FCMP_PREDICATE,
"Invalid predicate in FCmp instruction!", &FC);
visitInstruction(FC);
}