mirror of
https://github.com/RPCS3/llvm.git
synced 2026-01-31 01:25:19 +01:00
IR: Eliminate non-determinism in the module summary analysis.
Also make the summary ref and call graph vectors immutable. This means a smaller API surface and fewer places to audit for non-determinism. Differential Revision: https://reviews.llvm.org/D27875 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290200 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -3290,21 +3290,11 @@ void ModuleBitcodeWriter::writePerModuleFunctionSummaryRecord(
|
||||
NameVals.push_back(FS->instCount());
|
||||
NameVals.push_back(FS->refs().size());
|
||||
|
||||
unsigned SizeBeforeRefs = NameVals.size();
|
||||
for (auto &RI : FS->refs())
|
||||
NameVals.push_back(VE.getValueID(RI.getValue()));
|
||||
// Sort the refs for determinism output, the vector returned by FS->refs() has
|
||||
// been initialized from a DenseSet.
|
||||
std::sort(NameVals.begin() + SizeBeforeRefs, NameVals.end());
|
||||
|
||||
std::vector<FunctionSummary::EdgeTy> Calls = FS->calls();
|
||||
std::sort(Calls.begin(), Calls.end(),
|
||||
[this](const FunctionSummary::EdgeTy &L,
|
||||
const FunctionSummary::EdgeTy &R) {
|
||||
return getValueId(L.first) < getValueId(R.first);
|
||||
});
|
||||
bool HasProfileData = F.getEntryCount().hasValue();
|
||||
for (auto &ECI : Calls) {
|
||||
for (auto &ECI : FS->calls()) {
|
||||
NameVals.push_back(getValueId(ECI.first));
|
||||
if (HasProfileData)
|
||||
NameVals.push_back(static_cast<uint8_t>(ECI.second.Hotness));
|
||||
|
||||
Reference in New Issue
Block a user