add sanity check for indbr.
authorChris Lattner <sabre@nondot.org>
Thu, 29 Oct 2009 05:53:32 +0000 (05:53 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 29 Oct 2009 05:53:32 +0000 (05:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85496 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Instructions.cpp

index 1e63436883c896d12319c7833456c82c5fbbd78a..52d8735d89b7ab34b45d3ca3e84ffd5f603023cf 100644 (file)
@@ -3091,7 +3091,8 @@ void SwitchInst::setSuccessorV(unsigned idx, BasicBlock *B) {
 //===----------------------------------------------------------------------===//
 
 void IndirectBrInst::init(Value *Address, unsigned NumDests) {
-  assert(Address);
+  assert(Address && isa<PointerType>(Address->getType()) &&
+         "Address of indirectbr must be a pointer");
   ReservedSpace = 1+NumDests;
   NumOperands = 1;
   OperandList = allocHungoffUses(ReservedSpace);