mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
ThinLTO: fix non-determinism in bitcode writing
Calls are initialized from a DenseMap. We can sort them using the value id to recover some determinism during serialization. From: mehdi_amini <mehdi_amini@91177308-0d34-0410-b5e6-96231b3b80d8> llvm-svn: 269638
This commit is contained in:
parent
04ed4da38c
commit
028250d333
@ -3177,8 +3177,15 @@ void ModuleBitcodeWriter::writePerModuleFunctionSummaryRecord(
|
||||
|
||||
NameVals.insert(NameVals.end(), Refs.begin(), Refs.end());
|
||||
|
||||
std::vector<FunctionSummary::EdgeTy> Calls = FS->calls();
|
||||
std::sort(Calls.begin(), Calls.end(),
|
||||
[this](const FunctionSummary::EdgeTy &L,
|
||||
const FunctionSummary::EdgeTy &R) {
|
||||
return VE.getValueID(L.first.getValue()) <
|
||||
VE.getValueID(R.first.getValue());
|
||||
});
|
||||
bool HasProfileData = F.getEntryCount().hasValue();
|
||||
for (auto &ECI : FS->calls()) {
|
||||
for (auto &ECI : Calls) {
|
||||
NameVals.push_back(VE.getValueID(ECI.first.getValue()));
|
||||
assert(ECI.second.CallsiteCount > 0 && "Expected at least one callsite");
|
||||
NameVals.push_back(ECI.second.CallsiteCount);
|
||||
|
Loading…
Reference in New Issue
Block a user