[PATCH] D57986: [ProfileData] Sort FuncData before iteration to remove non-determinism
Jonas Hahnfeld via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 1 03:59:18 PST 2019
Hahnfeld added a comment.
I think this patch is right in also sorting the function names: AFAICS `StringMap` doesn't provide that guarantee.
================
Comment at: lib/ProfileData/InstrProfWriter.cpp:393-403
+ llvm::sort(OrderedFuncData, [](const RecordType &A, const RecordType &B) {
+ auto nameA = A.first;
+ auto nameB = B.first;
+ int comp = nameA.compare(nameB);
+ if (comp)
+ return comp < 0;
+
----------------
Please run `clang-format`, the lambda should only be indented by two additional spaces. Also can you put the explicit types for `nameA` et al.? That should be `StringRef` and `uint64_t` for the hashes.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57986/new/
https://reviews.llvm.org/D57986
More information about the cfe-commits
mailing list