From d2db881e8552ec3e5a1b20f91e8d07d6424d6855 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Wed, 22 Apr 2015 18:16:49 +0000 Subject: Revert "[opaque pointer type] Avoid using PointerType::getElementType for a few cases of CallInst" This reverts commit r235458. It looks like this might be breaking something LTO-ish. Looking into it & will recommit with a fix/test case/etc once I've got more to go on. llvm-svn: 235533 --- llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp') 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(Callee->getType()); if (!OpTy) return Error("Callee is not a pointer type"); - if (!FTy) { - FTy = dyn_cast(OpTy->getElementType()); - if (!FTy) - return Error("Callee is not of pointer to function type"); - } else if (OpTy->getElementType() != FTy) + FunctionType *PFTy = dyn_cast(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(I)->setCallingConv( static_cast((~(1U << 14) & CCInfo) >> 1)); -- cgit v1.2.3