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 | 230c1a7222aa0c975120cf03a612117fe471fb78 (patch) | |
tree | 0141a88b5bffd9a80d3f335a59d12bfa20626638 /lib/VMCore | |
parent | b4f4880eba456ed240beb6eb571339efbd0bf65f (diff) | |
download | external_llvm-230c1a7222aa0c975120cf03a612117fe471fb78.zip external_llvm-230c1a7222aa0c975120cf03a612117fe471fb78.tar.gz external_llvm-230c1a7222aa0c975120cf03a612117fe471fb78.tar.bz2 |
Add support for checking the select instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12325 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r-- | lib/VMCore/Verifier.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index bf530a4..dfac6b9 100644 --- a/lib/VMCore/Verifier.cpp +++ b/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. /// |