]> granicus.if.org Git - llvm/commit
[AutoFDO] Make call targets order deterministic for sample profile
authorWenlei He <aktoon@gmail.com>
Tue, 20 Aug 2019 20:52:00 +0000 (20:52 +0000)
committerWenlei He <aktoon@gmail.com>
Tue, 20 Aug 2019 20:52:00 +0000 (20:52 +0000)
commit35a6ef8d30c7d24dd9a2d30a3e7475ee1c4d1663
treef2aa0587d2e303cb0a5d449e81f32d10df70fd20
parentc94fa3d72dd3976ac07091dd97fff748b7992faf
[AutoFDO] Make call targets order deterministic for sample profile

Summary:
StringMap is used for storing call target to frequency map for AutoFDO. However the iterating order of StringMap is non-deterministic, which leads to non-determinism in AutoFDO profile output. Now new API getSortedCallTargets and SortCallTargets are added for deterministic ordering and output.

Roundtrip test for text profile and binary profile is added.

Reviewers: wmi, davidxl, danielcdh

Subscribers: hiraditya, mgrang, llvm-commits, twoh

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D66191

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369440 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/ProfileData/SampleProf.h
lib/ProfileData/SampleProf.cpp
lib/ProfileData/SampleProfWriter.cpp
lib/Transforms/IPO/SampleProfile.cpp
test/tools/llvm-profdata/Inputs/sample-profile.proftext
test/tools/llvm-profdata/roundtrip.test
test/tools/llvm-profdata/sample-profile-basic.test