Skip to content

Commit f43e0ae

Browse files
committed
Bitcode: Merge the code for parsing global value module codes in the summary bitcode reader. NFCI.
This code will need to be taught to handle string tables and it's better if there is only one copy of it. Differential Revision: https://reviews.llvm.org/D31829 llvm-svn: 299886
1 parent 2bca1a9 commit f43e0ae

File tree

1 file changed

+6
-26
lines changed

1 file changed

+6
-26
lines changed

llvm/lib/Bitcode/Reader/BitcodeReader.cpp

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4742,33 +4742,13 @@ Error ModuleSummaryIndexBitcodeReader::parseModule(StringRef ModulePath) {
47424742
// was historically always the start of the regular bitcode header.
47434743
VSTOffset = Record[0] - 1;
47444744
break;
4745-
// GLOBALVAR: [pointer type, isconst, initid,
4746-
// linkage, alignment, section, visibility, threadlocal,
4747-
// unnamed_addr, externally_initialized, dllstorageclass,
4748-
// comdat]
4749-
case bitc::MODULE_CODE_GLOBALVAR: {
4750-
if (Record.size() < 6)
4751-
return error("Invalid record");
4752-
uint64_t RawLinkage = Record[3];
4753-
GlobalValue::LinkageTypes Linkage = getDecodedLinkage(RawLinkage);
4754-
ValueIdToLinkageMap[ValueId++] = Linkage;
4755-
break;
4756-
}
4757-
// FUNCTION: [type, callingconv, isproto, linkage, paramattr,
4758-
// alignment, section, visibility, gc, unnamed_addr,
4759-
// prologuedata, dllstorageclass, comdat, prefixdata]
4760-
case bitc::MODULE_CODE_FUNCTION: {
4761-
if (Record.size() < 8)
4762-
return error("Invalid record");
4763-
uint64_t RawLinkage = Record[3];
4764-
GlobalValue::LinkageTypes Linkage = getDecodedLinkage(RawLinkage);
4765-
ValueIdToLinkageMap[ValueId++] = Linkage;
4766-
break;
4767-
}
4768-
// ALIAS: [alias type, addrspace, aliasee val#, linkage, visibility,
4769-
// dllstorageclass]
4745+
// GLOBALVAR: [pointer type, isconst, initid, linkage, ...]
4746+
// FUNCTION: [type, callingconv, isproto, linkage, ...]
4747+
// ALIAS: [alias type, addrspace, aliasee val#, linkage, ...]
4748+
case bitc::MODULE_CODE_GLOBALVAR:
4749+
case bitc::MODULE_CODE_FUNCTION:
47704750
case bitc::MODULE_CODE_ALIAS: {
4771-
if (Record.size() < 6)
4751+
if (Record.size() <= 3)
47724752
return error("Invalid record");
47734753
uint64_t RawLinkage = Record[3];
47744754
GlobalValue::LinkageTypes Linkage = getDecodedLinkage(RawLinkage);

0 commit comments

Comments
 (0)