================ @@ -363,9 +364,27 @@ Error YAMLProfileReader::readProfile(BinaryContext &BC) { return Profile.Hash == static_cast<uint64_t>(BF.getHash()); }; - // We have to do 2 passes since LTO introduces an ambiguity in function - // names. The first pass assigns profiles that match 100% by name and - // by hash. The second pass allows name ambiguity for LTO private functions. + uint64_t MatchedWithExactName = 0; + uint64_t MatchedWithHash = 0; + uint64_t MatchedWithLTOCommonName = 0; + + // Computes hash for binary functions. + if (opts::MatchingFunctionsWithHash) { + for (auto &[_, BF] : BC.getBinaryFunctions()) + BF.computeHash(YamlBP.Header.IsDFSOrder, YamlBP.Header.HashFunction); + } else { + for (auto [YamlBF, BF] : llvm::zip_equal(YamlBP.Functions, ProfileBFs)) { + if (!BF) + continue; + BinaryFunction &Function = *BF; + + if (!opts::IgnoreHash) + Function.computeHash(YamlBP.Header.IsDFSOrder, + YamlBP.Header.HashFunction); + } + } ---------------- aaupov wrote:
```suggestion if (opts::MatchingFunctionsWithHash) for (auto &[_, BF] : BC.getBinaryFunctions()) BF.computeHash(YamlBP.Header.IsDFSOrder, YamlBP.Header.HashFunction); else if (!opts::IgnoreHash) for (BinaryFunction *BF : ProfileBFs) BF->computeHash(YamlBP.Header.IsDFSOrder, YamlBP.Header.HashFunction); ``` https://github.com/llvm/llvm-project/pull/95821 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits