diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp --- a/llvm/lib/IR/Value.cpp +++ b/llvm/lib/IR/Value.cpp @@ -58,8 +58,11 @@ // FIXME: Why isn't this in the subclass gunk?? // Note, we cannot call isa before the CallInst has been // constructed. - if (SubclassID == Instruction::Call || SubclassID == Instruction::Invoke || - SubclassID == Instruction::CallBr) + unsigned OpCode = 0; + if (SubclassID >= InstructionVal) + OpCode = SubclassID - InstructionVal; + if (OpCode == Instruction::Call || OpCode == Instruction::Invoke || + OpCode == Instruction::CallBr) assert((VTy->isFirstClassType() || VTy->isVoidTy() || VTy->isStructTy()) && "invalid CallInst type!"); else if (SubclassID != BasicBlockVal &&