summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2015-04-21 23:26:57 +0000
committerDavid Blaikie <dblaikie@gmail.com>2015-04-21 23:26:57 +0000
commit506993636e7300bedd7555ebd4c820b10ffd9017 (patch)
treeb21b9ca1bf999f79d01ac2333bc5fc2c9cc81f67 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parentb8854d01a6ef9524448b5a34771383cf4d969870 (diff)
downloadbcm5719-llvm-506993636e7300bedd7555ebd4c820b10ffd9017.tar.gz
bcm5719-llvm-506993636e7300bedd7555ebd4c820b10ffd9017.zip
[opaque pointer type] Avoid using PointerType::getElementType for a few cases of CallInst
Calls to llvm::Value::mutateType are becoming extra-sensitive now that instructions have extra type information that will not be derived from operands or result type (alloca, gep, load, call/invoke, etc... ). The special-handling for mutateType will get more complicated as this work continues - it might be worth making mutateType virtual & pushing the complexity down into the classes that need special handling. But with only two significant uses of mutateType (vectorization and linking) this seems OK for now. Totally open to ideas/suggestions/improvements, of course. With this, and a bunch of exceptions, we can roundtrip an indirect call site through bitcode and IR. (a direct call site is actually trickier... I haven't figured out how to deal with the IR deserializer's lazy construction of Function/GlobalVariable decl's based on the type of the entity which means looking through the "pointer to T" type referring to the global) llvm-svn: 235458
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index bc78a71efad..f3446b73f93 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -4184,12 +4184,11 @@ std::error_code BitcodeReader::ParseFunctionBody(Function *F) {
PointerType *OpTy = dyn_cast<PointerType>(Callee->getType());
if (!OpTy)
return Error("Callee is not a pointer type");
- 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)
+ 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)
return Error("Explicit call type does not match pointee type of "
"callee operand");
if (Record.size() < FTy->getNumParams() + OpNum)
@@ -4220,7 +4219,7 @@ std::error_code BitcodeReader::ParseFunctionBody(Function *F) {
}
}
- I = CallInst::Create(Callee, Args);
+ I = CallInst::Create(FTy, Callee, Args);
InstructionList.push_back(I);
cast<CallInst>(I)->setCallingConv(
static_cast<CallingConv::ID>((~(1U << 14) & CCInfo) >> 1));
OpenPOWER on IntegriCloud