This is an archive of the discontinued LLVM Phabricator instance.

[BOLT] Remove dependency on StringMap iteration order
ClosedPublic

Authored by maksfb on Mar 2 2023, 2:35 PM.

Details

Summary

Remove the usage of StringMap in places where the iteration order
affects the output since the iteration over StringMap is
non-deterministic.

Diff Detail

Event Timeline

maksfb created this revision.Mar 2 2023, 2:35 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 2 2023, 2:35 PM
maksfb requested review of this revision.Mar 2 2023, 2:35 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 2 2023, 2:35 PM
Amir accepted this revision.Mar 3 2023, 9:15 AM

What's the reason behind Counts/JumpTableCounts being a MapVector<StringRef, uint64_t in ReorderData::assignMemData but NamesToBranchesMapTy being an std::map<StringRef, FuncBranchData>?

This revision is now accepted and ready to land.Mar 3 2023, 9:15 AM
maksfb added a comment.Mar 3 2023, 9:20 AM

What's the reason behind Counts/JumpTableCounts being a MapVector<StringRef, uint64_t in ReorderData::assignMemData but NamesToBranchesMapTy being an std::map<StringRef, FuncBranchData>?

Different order of iteration over the elements. For MapVector<> it's the insertion order.

This revision was automatically updated to reflect the committed changes.