diff options
author | Chris Lattner <sabre@nondot.org> | 2004-03-12 05:54:31 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-03-12 05:54:31 +0000 |
commit | 75648e7ae48d477aa36230243eeda4ec4a799d10 (patch) | |
tree | ee19cb24c5de3420ef95af6a1c5da9c6e014a0ba /llvm/lib/VMCore/Verifier.cpp | |
parent | 8337d4462f77ea621657cae58133599f667ce248 (diff) | |
download | bcm5719-llvm-75648e7ae48d477aa36230243eeda4ec4a799d10.tar.gz bcm5719-llvm-75648e7ae48d477aa36230243eeda4ec4a799d10.zip |
Add support for checking the select instruction
llvm-svn: 12325
Diffstat (limited to 'llvm/lib/VMCore/Verifier.cpp')
-rw-r--r-- | llvm/lib/VMCore/Verifier.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/Verifier.cpp b/llvm/lib/VMCore/Verifier.cpp index bf530a4b1a9..dfac6b94cf3 100644 --- a/llvm/lib/VMCore/Verifier.cpp +++ b/llvm/lib/VMCore/Verifier.cpp @@ -144,6 +144,7 @@ namespace { // Anonymous namespace for class void visitInstruction(Instruction &I); void visitTerminatorInst(TerminatorInst &I); void visitReturnInst(ReturnInst &RI); + void visitSelectInst(SelectInst &SI); void visitUserOp1(Instruction &I); void visitUserOp2(Instruction &I) { visitUserOp1(I); } void visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI); @@ -335,6 +336,16 @@ void Verifier::visitReturnInst(ReturnInst &RI) { visitTerminatorInst(RI); } +void Verifier::visitSelectInst(SelectInst &SI) { + Assert1(SI.getCondition()->getType() == Type::BoolTy, + "Select condition type must be bool!", &SI); + Assert1(SI.getTrueValue()->getType() == SI.getFalseValue()->getType(), + "Select values must have identical types!", &SI); + Assert1(SI.getTrueValue()->getType() == SI.getType(), + "Select values must have same type as select instruction!", &SI); +} + + /// visitUserOp1 - User defined operators shouldn't live beyond the lifetime of /// a pass, if any exist, it's an error. /// |