[llvm-profgen] Fix a typo in collectProfiledFunctions
authorHongtao Yu <hoy@fb.com>
Tue, 1 Nov 2022 22:17:57 +0000 (15:17 -0700)
committerHongtao Yu <hoy@fb.com>
Tue, 1 Nov 2022 23:52:39 +0000 (16:52 -0700)
As titled. The change should have minimal impact since the targets of branch samples are mostly covered by range samples.

Reviewed By: wenlei, wlei

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

llvm/tools/llvm-profgen/ProfileGenerator.cpp

index e111078..dd8f069 100644 (file)
@@ -434,7 +434,7 @@ bool ProfileGeneratorBase::collectFunctionsFromRawProfile(
 
     for (auto Item : CI.second.BranchCounter) {
       uint64_t SourceAddress = Item.first.first;
-      uint64_t TargetAddress = Item.first.first;
+      uint64_t TargetAddress = Item.first.second;
       if (FuncRange *FRange = Binary->findFuncRange(SourceAddress))
         ProfiledFunctions.insert(FRange->Func);
       if (FuncRange *FRange = Binary->findFuncRange(TargetAddress))