diff options
author | Nate Begeman <natebegeman@mac.com> | 2008-05-14 20:28:31 +0000 |
---|---|---|
committer | Nate Begeman <natebegeman@mac.com> | 2008-05-14 20:28:31 +0000 |
commit | 03b5528c4741b6ff052dc26195042f1a3ef68dac (patch) | |
tree | e042cf51567435744c6b7cde710ed4050362d1fd /include | |
parent | 328064990075e03dcb709e735fbdc8dd2134a708 (diff) | |
download | external_llvm-03b5528c4741b6ff052dc26195042f1a3ef68dac.zip external_llvm-03b5528c4741b6ff052dc26195042f1a3ef68dac.tar.gz external_llvm-03b5528c4741b6ff052dc26195042f1a3ef68dac.tar.bz2 |
Don't generate unused variables in a no-assert build
Add some checks to the new vicmp,vfcmp instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51125 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Instructions.h | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h index 4808e11..e5de229 100644 --- a/include/llvm/Instructions.h +++ b/include/llvm/Instructions.h @@ -627,12 +627,11 @@ public: assert(pred >= CmpInst::FIRST_ICMP_PREDICATE && pred <= CmpInst::LAST_ICMP_PREDICATE && "Invalid ICmp predicate value"); - const Type* Op0Ty = getOperand(0)->getType(); - const Type* Op1Ty = getOperand(1)->getType(); - assert(Op0Ty == Op1Ty && + assert(getOperand(0)->getType() == getOperand(1)->getType() && "Both operands to ICmp instruction are not of the same type!"); // Check that the operands are the right type - assert((Op0Ty->isInteger() || isa<PointerType>(Op0Ty)) && + assert((getOperand(0)->getType()->isInteger() || + isa<PointerType>(getOperand(0)->getType())) && "Invalid operand types for ICmp instruction"); } @@ -648,12 +647,11 @@ public: assert(pred >= CmpInst::FIRST_ICMP_PREDICATE && pred <= CmpInst::LAST_ICMP_PREDICATE && "Invalid ICmp predicate value"); - const Type* Op0Ty = getOperand(0)->getType(); - const Type* Op1Ty = getOperand(1)->getType(); - assert(Op0Ty == Op1Ty && + assert(getOperand(0)->getType() == getOperand(1)->getType() && "Both operands to ICmp instruction are not of the same type!"); // Check that the operands are the right type - assert((Op0Ty->isInteger() || isa<PointerType>(Op0Ty)) && + assert((getOperand(0)->getType()->isInteger() || + isa<PointerType>(getOperand(0)->getType())) && "Invalid operand types for ICmp instruction"); } @@ -796,12 +794,10 @@ public: InsertBefore) { assert(pred <= FCmpInst::LAST_FCMP_PREDICATE && "Invalid FCmp predicate value"); - const Type* Op0Ty = getOperand(0)->getType(); - const Type* Op1Ty = getOperand(1)->getType(); - assert(Op0Ty == Op1Ty && + assert(getOperand(0)->getType() == getOperand(1)->getType() && "Both operands to FCmp instruction are not of the same type!"); // Check that the operands are the right type - assert(Op0Ty->isFloatingPoint() && + assert(getOperand(0)->getType()->isFloatingPoint() && "Invalid operand types for FCmp instruction"); } @@ -816,12 +812,10 @@ public: InsertAtEnd) { assert(pred <= FCmpInst::LAST_FCMP_PREDICATE && "Invalid FCmp predicate value"); - const Type* Op0Ty = getOperand(0)->getType(); - const Type* Op1Ty = getOperand(1)->getType(); - assert(Op0Ty == Op1Ty && + assert(getOperand(0)->getType() == getOperand(1)->getType() && "Both operands to FCmp instruction are not of the same type!"); // Check that the operands are the right type - assert(Op0Ty->isFloatingPoint() && + assert(getOperand(0)->getType()->isFloatingPoint() && "Invalid operand types for FCmp instruction"); } @@ -913,6 +907,11 @@ public: Instruction *InsertBefore = 0 ///< Where to insert ) : CmpInst(LHS->getType(), Instruction::VICmp, pred, LHS, RHS, Name, InsertBefore) { + assert(pred >= CmpInst::FIRST_ICMP_PREDICATE && + pred <= CmpInst::LAST_ICMP_PREDICATE && + "Invalid VICmp predicate value"); + assert(getOperand(0)->getType() == getOperand(1)->getType() && + "Both operands to VICmp instruction are not of the same type!"); } /// @brief Constructor with insert-at-block-end semantics. @@ -924,6 +923,11 @@ public: BasicBlock *InsertAtEnd ///< Block to insert into. ) : CmpInst(LHS->getType(), Instruction::VICmp, pred, LHS, RHS, Name, InsertAtEnd) { + assert(pred >= CmpInst::FIRST_ICMP_PREDICATE && + pred <= CmpInst::LAST_ICMP_PREDICATE && + "Invalid VICmp predicate value"); + assert(getOperand(0)->getType() == getOperand(1)->getType() && + "Both operands to VICmp instruction are not of the same type!"); } /// @brief Return the predicate for this instruction. @@ -960,6 +964,10 @@ public: Instruction *InsertBefore = 0 ///< Where to insert ) : CmpInst(VectorType::getInteger(cast<VectorType>(LHS->getType())), Instruction::VFCmp, pred, LHS, RHS, Name, InsertBefore) { + assert(pred <= CmpInst::LAST_FCMP_PREDICATE && + "Invalid VFCmp predicate value"); + assert(getOperand(0)->getType() == getOperand(1)->getType() && + "Both operands to VFCmp instruction are not of the same type!"); } /// @brief Constructor with insert-at-block-end semantics. @@ -971,6 +979,10 @@ public: BasicBlock *InsertAtEnd ///< Block to insert into. ) : CmpInst(VectorType::getInteger(cast<VectorType>(LHS->getType())), Instruction::VFCmp, pred, LHS, RHS, Name, InsertAtEnd) { + assert(pred <= CmpInst::LAST_FCMP_PREDICATE && + "Invalid VFCmp predicate value"); + assert(getOperand(0)->getType() == getOperand(1)->getType() && + "Both operands to VFCmp instruction are not of the same type!"); } /// @brief Return the predicate for this instruction. |