aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff options
context:
space:
mode:
authorEric Liu <ioeric@google.com>2017-05-04 11:49:39 +0000
committerEric Liu <ioeric@google.com>2017-05-04 11:49:39 +0000
commitf6039f255e0f85224c37a228a3cb6659b351796e (patch)
tree5042e47c514cad95e41a4fba95613227dcd0a2d2 /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
parentdd12594345b0e2156a524f88a43dfaeb5ab65f1d (diff)
downloadllvm-f6039f255e0f85224c37a228a3cb6659b351796e.zip
llvm-f6039f255e0f85224c37a228a3cb6659b351796e.tar.gz
llvm-f6039f255e0f85224c37a228a3cb6659b351796e.tar.bz2
Revert "IR: Use pointers instead of GUIDs to represent edges in the module summary. NFCI."
This reverts commit r302108. This causes crash in clang bootstrap with LTO. Contacted the auther in the original commit. llvm-svn: 302140
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index 1b8d81a..485d9b6 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -156,14 +156,14 @@ public:
return;
for (const auto &GUIDSummaryLists : *Index)
// Examine all summaries for this GUID.
- for (auto &Summary : GUIDSummaryLists.second.SummaryList)
+ for (auto &Summary : GUIDSummaryLists.second)
if (auto FS = dyn_cast<FunctionSummary>(Summary.get()))
// For each call in the function summary, see if the call
// is to a GUID (which means it is for an indirect call,
// otherwise we would have a Value for it). If so, synthesize
// a value id.
for (auto &CallEdge : FS->calls())
- if (!CallEdge.first.getValue())
+ if (CallEdge.first.isGUID())
assignValueId(CallEdge.first.getGUID());
}
@@ -304,7 +304,7 @@ private:
}
// Helper to get the valueId for the type of value recorded in VI.
unsigned getValueId(ValueInfo VI) {
- if (!VI.getValue())
+ if (VI.isGUID())
return getValueId(VI.getGUID());
return VE.getValueID(VI.getValue());
}
@@ -358,7 +358,7 @@ public:
Callback(Summary);
} else {
for (auto &Summaries : Index)
- for (auto &Summary : Summaries.second.SummaryList)
+ for (auto &Summary : Summaries.second)
Callback({Summaries.first, Summary.get()});
}
}
@@ -3270,14 +3270,15 @@ void ModuleBitcodeWriter::writePerModuleFunctionSummaryRecord(
void ModuleBitcodeWriter::writeModuleLevelReferences(
const GlobalVariable &V, SmallVector<uint64_t, 64> &NameVals,
unsigned FSModRefsAbbrev) {
- auto VI = Index->getValueInfo(GlobalValue::getGUID(V.getName()));
- if (!VI || VI.getSummaryList().empty()) {
+ auto Summaries =
+ Index->findGlobalValueSummaryList(GlobalValue::getGUID(V.getName()));
+ if (Summaries == Index->end()) {
// Only declarations should not have a summary (a declaration might however
// have a summary if the def was in module level asm).
assert(V.isDeclaration());
return;
}
- auto *Summary = VI.getSummaryList()[0].get();
+ auto *Summary = Summaries->second.front().get();
NameVals.push_back(VE.getValueID(&V));
GlobalVarSummary *VS = cast<GlobalVarSummary>(Summary);
NameVals.push_back(getEncodedGVSummaryFlags(VS->flags()));
@@ -3366,14 +3367,15 @@ void ModuleBitcodeWriter::writePerModuleGlobalValueSummary() {
if (!F.hasName())
report_fatal_error("Unexpected anonymous function when writing summary");
- ValueInfo VI = Index->getValueInfo(GlobalValue::getGUID(F.getName()));
- if (!VI || VI.getSummaryList().empty()) {
+ auto Summaries =
+ Index->findGlobalValueSummaryList(GlobalValue::getGUID(F.getName()));
+ if (Summaries == Index->end()) {
// Only declarations should not have a summary (a declaration might
// however have a summary if the def was in module level asm).
assert(F.isDeclaration());
continue;
}
- auto *Summary = VI.getSummaryList()[0].get();
+ auto *Summary = Summaries->second.front().get();
writePerModuleFunctionSummaryRecord(NameVals, Summary, VE.getValueID(&F),
FSCallsAbbrev, FSCallsProfileAbbrev, F);
}