diff options
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index a16be24a5b5..162dd2c4c74 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -4207,11 +4207,12 @@ std::error_code BitcodeReader::ParseFunctionBody(Function *F) { PointerType *OpTy = dyn_cast<PointerType>(Callee->getType()); if (!OpTy) return Error("Callee is not a pointer type"); - if (!FTy) { - FTy = dyn_cast<FunctionType>(OpTy->getElementType()); - if (!FTy) - return Error("Callee is not of pointer to function type"); - } else if (OpTy->getElementType() != FTy) + FunctionType *PFTy = dyn_cast<FunctionType>(OpTy->getElementType()); + if (!PFTy) + return Error("Callee is not of pointer to function type"); + if (!FTy) + FTy = PFTy; + if (PFTy != FTy) return Error("Explicit call type does not match pointee type of " "callee operand"); if (Record.size() < FTy->getNumParams() + OpNum) @@ -4242,7 +4243,7 @@ std::error_code BitcodeReader::ParseFunctionBody(Function *F) { } } - I = CallInst::Create(FTy, Callee, Args); + I = CallInst::Create(Callee, Args); InstructionList.push_back(I); cast<CallInst>(I)->setCallingConv( static_cast<CallingConv::ID>((~(1U << 14) & CCInfo) >> 1)); |