summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Reader
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Bitcode/Reader')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 412f99d5e62..b23115ba31d 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -2892,7 +2892,8 @@ static void inferDSOLocal(GlobalValue *GV) {
Error BitcodeReader::parseGlobalVarRecord(ArrayRef<uint64_t> Record) {
// v1: [pointer type, isconst, initid, linkage, alignment, section,
// visibility, threadlocal, unnamed_addr, externally_initialized,
- // dllstorageclass, comdat, attributes, preemption specifier] (name in VST)
+ // dllstorageclass, comdat, attributes, preemption specifier,
+ // partition strtab offset, partition strtab size] (name in VST)
// v2: [strtab_offset, strtab_size, v1]
StringRef Name;
std::tie(Name, Record) = readNameFromStrtab(Record);
@@ -2983,6 +2984,10 @@ Error BitcodeReader::parseGlobalVarRecord(ArrayRef<uint64_t> Record) {
}
inferDSOLocal(NewGV);
+ // Check whether we have enough values to read a partition name.
+ if (Record.size() > 15)
+ NewGV->setPartition(StringRef(Strtab.data() + Record[14], Record[15]));
+
return Error::success();
}
@@ -3072,6 +3077,12 @@ Error BitcodeReader::parseFunctionRecord(ArrayRef<uint64_t> Record) {
}
inferDSOLocal(Func);
+ // Record[16] is the address space number.
+
+ // Check whether we have enough values to read a partition name.
+ if (Record.size() > 18)
+ Func->setPartition(StringRef(Strtab.data() + Record[17], Record[18]));
+
ValueList.push_back(Func);
// If this is a function with a body, remember the prototype we are
@@ -3149,6 +3160,13 @@ Error BitcodeReader::parseGlobalIndirectSymbolRecord(
NewGA->setDSOLocal(getDecodedDSOLocal(Record[OpNum++]));
inferDSOLocal(NewGA);
+ // Check whether we have enough values to read a partition name.
+ if (OpNum + 1 < Record.size()) {
+ NewGA->setPartition(
+ StringRef(Strtab.data() + Record[OpNum], Record[OpNum + 1]));
+ OpNum += 2;
+ }
+
ValueList.push_back(NewGA);
IndirectSymbolInits.push_back(std::make_pair(NewGA, Val));
return Error::success();
OpenPOWER on IntegriCloud