aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2022-02-23 16:32:40 +0100
committerNikita Popov <npopov@redhat.com>2022-02-23 16:36:20 +0100
commit4d37bbc429f61ea0f60233e258ebcb1dfc031513 (patch)
treea3cc943ab386d90100d10ba058e9d4cf240989ab /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parenta7db3c611b1e613ae43ef472c2352f2b81a0b607 (diff)
downloadllvm-4d37bbc429f61ea0f60233e258ebcb1dfc031513.zip
llvm-4d37bbc429f61ea0f60233e258ebcb1dfc031513.tar.gz
llvm-4d37bbc429f61ea0f60233e258ebcb1dfc031513.tar.bz2
[Bitcode] Store function type IDs rather than function types
This resolves one of the type ID propagation TODOs.
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 0433b8f..2547046 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -488,7 +488,7 @@ class BitcodeReader : public BitcodeReaderBase, public GVMaterializer {
/// types of a Type*. This is used during upgrades of typed pointer IR in
/// opaque pointer mode.
DenseMap<unsigned, SmallVector<unsigned, 1>> ContainedTypeIDs;
- DenseMap<Function *, FunctionType *> FunctionTypes;
+ DenseMap<Function *, unsigned> FunctionTypeIDs;
BitcodeReaderValueList ValueList;
Optional<MetadataLoader> MDLoader;
std::vector<Comdat *> ComdatList;
@@ -3503,7 +3503,7 @@ Error BitcodeReader::parseFunctionRecord(ArrayRef<uint64_t> Record) {
assert(Func->getFunctionType() == FTy &&
"Incorrect fully specified type provided for function");
- FunctionTypes[Func] = cast<FunctionType>(FTy);
+ FunctionTypeIDs[Func] = FTyID;
Func->setCallingConv(CC);
bool isProto = Record[2];
@@ -4092,14 +4092,14 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
unsigned ModuleMDLoaderSize = MDLoader->size();
// Add all the function arguments to the value table.
-#ifndef NDEBUG
unsigned ArgNo = 0;
- FunctionType *FTy = FunctionTypes[F];
-#endif
+ unsigned FTyID = FunctionTypeIDs[F];
for (Argument &I : F->args()) {
- assert(I.getType() == FTy->getParamType(ArgNo++) &&
+ unsigned ArgTyID = getContainedTypeID(FTyID, ArgNo + 1);
+ assert(I.getType() == getTypeByID(ArgTyID) &&
"Incorrect fully specified type for Function Argument");
- ValueList.push_back(&I, TODOTypeID);
+ ValueList.push_back(&I, ArgTyID);
+ ++ArgNo;
}
unsigned NextValueNo = ValueList.size();
BasicBlock *CurBB = nullptr;